Government data question and answer generation method and system based on trusted big model

Through the government data question-and-answer generation method based on trusted large models, the implicit representation of texts is optimized using the error set between government knowledge texts and paragraphs, which solves the problems of text homogeneity and repetition in the existing technology, and improves the quality of government responses and credibility.

CN119025663BActive Publication Date: 2024-12-17贵州华谊联盛科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411518088.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2024-12-17
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

The existing government data question and answer generation technology based on big model has problems of text homogeneity and duplication, and lacks an effective mechanism to accurately guide text information generation, resulting in low quality and credibility of government responses and cannot meet the diversity of users. need.

Method used

Using the government data question-and-answer generation method based on trusted big models, the text implicit representation is performed by obtaining government knowledge text, combining the government trusted big models to construct text information multiple times, and the text implicit representation is updated according to the error set adaptability between paragraphs , generate government response text.

Benefits of technology

It effectively eliminates text homogeneity and repetition, improves the quality and credibility of government affairs responses, ensures the correlation between the generated text and government affairs knowledge, and meets the diverse needs of users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025663B_ABST
    Figure CN119025663B_ABST
Patent Text Reader

Abstract

The present application provides a method and system for generating questions and answers for government data based on a trusted large model, which uses government knowledge text for embedding to obtain a text implicit representation set, performs multiple text information constructions, and generates government response texts based on X segments of text information obtained by the last text information construction. Each time a text information construction is completed to generate X segments of text information, an inter-paragraph error set that guides the error between any two preceding and following segments of text information in the currently generated X segments of text information can be obtained, and one or more text implicit representations in the text implicit representation set are adaptively updated through the inter-paragraph error set, and the adaptively updated text implicit representation set is loaded into the government trusted large model for the next text information construction, thereby increasing the text generation effect of the model. Based on the adaptive update of the text implicit representation set, the homogeneity and repetition of the generated text can be eliminated, and the generation effect of the government response text is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and system for generating government data questions and answers based on a trusted big model. Background Art

[0002] With the rapid development of information technology, the management and application of government data plays an increasingly important role in modern social governance. Government departments need to deal with a large number of information queries, policy answers and other tasks. The traditional manual answering method is inefficient and difficult to meet the growing demand for government services. In recent years, big model technology has made significant progress and provided new ideas for the intelligent processing of government data. However, there are still many problems with the existing big model-based government data question and answer generation technology. On the one hand, when big models generate government response texts, text homogeneity and repetition are prone to occur. This not only affects the quality of government responses, reduces the professionalism and credibility of government services, but also fails to meet the diverse needs of users. On the other hand, when constructing government response texts, there is a lack of effective mechanisms to accurately guide the generation of text information, resulting in the generated text may not be strongly related to government knowledge and cannot accurately answer government-related questions. In order to improve the quality of government data question and answer generation and improve the efficiency and effectiveness of government services, a new government data question and answer generation method is urgently needed to overcome the above defects in the existing technology. Summary of the invention

[0003] In view of this, the embodiment of the present application at least provides a method and system for generating government data questions and answers based on a trusted big model. The technical solution of the present application is implemented as follows:

[0004] On the one hand, the present application provides a method for generating government data questions and answers based on a trusted big model, including: obtaining a government knowledge text, the government knowledge text is used to guide the text information in the government response text to be generated, the government response text includes X text paragraphs, X ≥ 2; according to the embedding of the government knowledge text, a text implicit representation set is obtained, the text implicit representation set includes X text implicit representations, each of the text implicit representations is used to characterize the government knowledge text; the x-th text implicit representation in the text implicit representation set is used to guide the construction of the x-th text paragraph in the government response text, x is a positive integer not greater than X; according to the text implicit representation set and the government trusted big model, multiple text information constructions are performed, and each text information construction constructs X paragraphs of text information are obtained, and the xth paragraph of text information corresponds to the xth text paragraph; wherein, when executing the multiple text information constructions, each time the text information construction is completed to obtain X paragraphs of text information, the inter-paragraph error set corresponding to the current X paragraphs of text information is obtained, and one or more text implicit representations in the text implicit representation set are adaptively updated according to the inter-paragraph error set, and the adaptively updated text implicit representation set is loaded into the government affairs trusted big model for the next text information construction; the inter-paragraph error set is used to characterize the error between any two preceding and following paragraphs of text information in the corresponding X paragraphs of text information; based on the X paragraphs of text information obtained by the last text information construction in the multiple text information constructions, the government affairs response text is generated.

[0005] On the other hand, the present application provides a computer system, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the steps in the above method when executing the program.

[0006] The beneficial effects of the present application are as follows: the present application adopts the embedding of the government knowledge text used to guide the text information in the government response text to be generated to obtain a text implicit representation set, and multiple text information constructions are performed through the text implicit representation set and the government trustworthy big model, so as to generate the government response text based on the X-segment text information obtained by the last text information construction. Among them, each time the text information construction is completed to generate X-segment text information, the paragraph error set that guides the error between any two preceding and following text information in the X-segment text information currently generated can be obtained, and one or more text implicit representations in the text implicit representation set can be adaptively updated through the paragraph error set, and the adaptively updated text implicit representation set is loaded into the government trustworthy big model for the next text information construction, so that the government trustworthy big model can determine the current text construction information according to the adaptively updated text implicit representation set when constructing the next text information, so as to determine the construction of the government response text and increase the text generation effect of the model. Further, based on the adaptive update of the text implicit representation set, the homogeneity and repetition of the text generated by the government trustworthy big model can be eliminated, and the generation effect of the government response text is better. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] Figure 1 A schematic diagram of the implementation process of a method for generating government data questions and answers based on a trusted big model provided in an embodiment of the present application.

[0008] Figure 2 A hardware entity diagram of a computer system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0009] The embodiment of the present application provides a method for generating government data questions and answers based on a trusted big model, which can be executed by a processor of a computer system. The computer system can refer to a device with data processing capabilities such as a server, a laptop, a tablet computer, a desktop computer, a mobile device, etc. Figure 1 A schematic diagram of the implementation process of a method for generating government data questions and answers based on a trusted large model provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0010] Step S100: Acquire a government affairs knowledge text, where the government affairs knowledge text is used to guide text information in a government affairs response text to be generated. The government affairs response text includes X text paragraphs, where X≥2.

[0011] In the embodiments of the present application, the government affairs knowledge text is a text content covering various knowledge information related to government affairs. For example, in a government affairs question-and-answer scenario about urban construction, the government affairs knowledge text may contain policy and legal provisions on urban planning, functional positioning information of different regions, and relevant standards for various infrastructure construction. From a broader perspective, it can be the document content in the policy document library and government affairs knowledge library from government departments, which are processed by the computer system into a text form that can be recognized and used.

[0012] There are many technical means for a computer system to obtain government knowledge texts. One feasible way is to extract data from a government database. Assume that the government database stores government information in a relational database, in which there is a table dedicated to storing various types of government knowledge documents. Each document has a corresponding field in the table to record its text content, document number, government field, and other information. The computer system can extract government knowledge texts with specific requirements by writing SQL query statements.

[0013] In addition, government knowledge texts can also be obtained through data interfaces. Many government systems provide external data interfaces, and computer systems can send requests according to the interface specifications and receive returned government knowledge texts. For example, using a RESTful API interface, the computer system sends a GET request to a specified URL (such as `https: / / governance-api.example.com / knowledge-text`) and carries the necessary authentication information (such as API key) as required by the interface. After verifying that the request is legitimate, the interface server returns the government knowledge text to the computer system in JSON or XML format.

[0014] The government response text is the answer text generated for government-related questions, while the government knowledge text provides the knowledge basis and guidance direction. For example, when a user asks about the new commercial land planning policy in a certain area, the information about the provisions of the land planning policy in the area, the land use classification standards, etc. in the government knowledge text will guide the computer system to generate a government response text containing accurate and relevant information. In addition, since the government response text contains multiple text paragraphs (X, X≥2), the government knowledge text also needs to be comprehensive and rich enough to support the construction of different paragraph contents. For example, the first paragraph may be a general response to the question, explaining the overall framework of the commercial land planning policy in the area; the second paragraph may detail the changes in the new policy compared with the old policy; the third paragraph may mention the expected impact of the new policy on local commercial development after its implementation. The construction direction of these different paragraphs needs to obtain relevant information from the government knowledge text to ensure the completeness, accuracy and professionalism of the government response text.

[0015] Step S200: Obtain a text implicit representation set based on the embedding of the government knowledge text, the text implicit representation set includes X text implicit representations, each text implicit representation is used to represent the government knowledge text; the x-th text implicit representation in the text implicit representation set is used to guide the construction of the x-th text paragraph in the government response text, and x is a positive integer not greater than X.

[0016] In the embodiment of the present application, the government knowledge text is obtained in step S100, which contains rich government-related information. The text implicit representation set is a special representation form of the government knowledge text. This set includes X text implicit representations, where X is consistent with the number of text paragraphs in the government response text (X≥2), and each text implicit representation is used to characterize the government knowledge text. Text embedding is the process of converting text data into a low-dimensional vector representation. For government knowledge text, the computer system maps it to a low-dimensional vector space through a specific algorithm. For example, in a simple word vector model, if there is the word "urban development" in the government knowledge text, it will be mapped to a point in a vector space. This vector may contain values ​​of multiple dimensions, such as [0.1, 0.2, -0.3,...]. This vector can represent the semantic information of the word "urban development" to a certain extent.

[0017] In actual operation, computer systems can use a variety of technical means to achieve text embedding. One feasible method is to use a pre-trained word vector model, such as Word2Vec. Word2Vec is pre-trained through a large amount of text corpus to learn the vector representation of each word. For government knowledge text, the computer system can replace each word with the corresponding Word2Vec vector, and then combine these word vectors into a vector that can represent the entire government knowledge text in some way (such as weighted average). Assume that the government knowledge text is ,in, Represents the i-th word, and the corresponding Word2Vec vector is , then the vector representation of the text can be calculated by the following formula : ;in, It can be the weight of a word, for example, it can be determined based on the importance of the word (such as word frequency, part of speech, etc. in the government knowledge text).

[0018] In addition to Word2Vec, there are other pre-trained models that can be used for text embedding, such as GloVe (Global Vectors for Word Representation). The GloVe model learns the vector representation of words based on the global word-word co-occurrence matrix. The computer system can convert the words in the government knowledge text into GloVe vectors and then combine them into the vector representation of the text in a similar way.

[0019] After the computer system embeds the government knowledge text, each implicit text representation in the obtained text implicit representation set has a unique meaning. Take a government knowledge text about tax policy as an example. Assume that the government response text needs to contain three paragraphs (X=3). The first implicit text representation may focus on extracting semantic information related to the basic concepts and framework of tax policy in the government knowledge text. This representation will guide the construction of the first text paragraph in the government response text. This paragraph may first give a general introduction to the tax policy, including basic information such as the types of taxes and the objects of taxation; the second implicit text representation may focus on the semantic information of the adjustment and change of tax policy in the government knowledge text. This will be used to construct the second text paragraph in the government response text. This paragraph may elaborate on the content and reasons of the adjustment of tax policy in different periods; the third implicit text representation may focus on the semantic information of the impact of tax policy on society and economy in the government knowledge text, thereby guiding the construction of the third text paragraph in the government response text. This paragraph may discuss how tax policy affects the development of enterprises and the allocation of social resources.

[0020] Through such a text embedding process, the computer system converts the government knowledge text into a set of implicit text representations that are more convenient for subsequent processing. This representation form can be combined with the government trustworthy big model in the subsequent steps to provide effective guidance information for constructing each paragraph in the government response text, so that the government response text can accurately and comprehensively answer government-related questions. At the same time, it also lays an important foundation for the entire government data question and answer generation method, ensuring that the construction basis of different paragraph contents is derived from the semantic connotation of the government knowledge text.

[0021] Step S300: multiple text information constructions are performed according to the text implicit representation set and the government affairs trusted big model, each time the text information construction is performed, X segments of text information are constructed, and the xth segment of text information corresponds to the xth text paragraph; wherein, when multiple text information constructions are performed, each time the text information construction is completed to obtain X segments of text information, the inter-paragraph error set corresponding to the current X segments of text information is obtained, and one or more text implicit representations in the text implicit representation set are adaptively updated according to the inter-paragraph error set, and the adaptively updated text implicit representation set is loaded into the government affairs trusted big model for the next text information construction; the inter-paragraph error set is used to characterize the error between any two segments of text information in the corresponding X segments of text information.

[0022] In step S300 of the embodiment of the present application, text information construction refers to the use of an existing set of implicit text representations (obtained in step S200, which includes X implicit text representations, each of which is related to the government knowledge text and is used to guide a paragraph in the government response text) and a large government trust model (this is a pre-built model that is considered to be reliable in data processing in the government field) to generate text information. Each time the text information is constructed, X segments of text information will be obtained, where the xth segment of text information corresponds to the xth text paragraph in the government response text (x is a positive integer not greater than X). In this process, the computer system can adopt a variety of technical means. For example, the large government trust model may be a neural network model based on deep learning, such as a model with a Transformer architecture. This model has the characteristics of a multi-head attention mechanism and can handle long-distance dependencies in text data well. The computer system uses each representation in the set of implicit text representations as one of the input features of the model, combines the parameters and structure of the model itself, and calculates according to the forward propagation algorithm of the model to generate X segments of text information.

[0023] For each text information construction, when the computer system completes the construction and obtains X paragraphs of text information, a series of operations will be performed. This includes obtaining the inter-paragraph error set corresponding to the current X paragraphs of text information. The inter-paragraph error set here is a set used to characterize the errors between any two paragraphs of text information in the corresponding X paragraphs of text information. The concept of this error can be understood from multiple perspectives, such as from the perspective of semantic similarity. Suppose the two paragraphs of text information are and , the computer system can determine the error by calculating the semantic similarity between them. One feasible method for calculating semantic similarity is based on the cosine similarity of word vectors. and The words in are converted into word vectors (for example, through the pre-trained Word2Vec model), represented as vector sets and , then the semantic similarity S of two texts can be calculated by the following formula: ; where n is the number of words selected for calculation (it can be selected according to some rules, such as selecting words with the same part of speech in two texts, etc.), and They are and The word vector corresponding to the i-th word in , represents the vector dot product, and the error can be expressed as 1-S.

[0024] The purpose of obtaining the set of inter-paragraph errors is to adaptively update one or more implicit text representations in the set of text implicit representations. This step is very important because it can make the subsequent text information construction more accurate and reasonable. Taking a government question and answer about people's livelihood policies as an example, assume that three paragraphs of text information are obtained in a text information construction, corresponding to three paragraphs in the government response text. The first paragraph may be about the overall goal of the people's livelihood policy, the second paragraph is the specific implementation measures, and the third paragraph is the expected effect after the implementation of the policy. If the computer system finds that the semantic coherence between the first and second paragraphs is poor (that is, the inter-paragraph error is large), it may be because when constructing these two paragraphs of text information, the initial implicit text representation has some deficiencies in guidance. At this time, by adaptively updating the implicit text representation, the guidance direction of the next construction of the two paragraphs can be adjusted to make the semantic coherence between the two paragraphs better.

[0025] After adaptively updating the implicit text representation set, the computer system will load the adaptively updated implicit text representation set into the government affairs trustworthy big model for the next text information construction. In this way, the government affairs trustworthy big model can determine the current text construction information based on the updated representation set in the subsequent construction process, so as to better construct the government affairs response text. For example, if the initial implicit text representation is not accurate enough in representing a certain government affairs concept, after adaptive updating, the government affairs trustworthy big model can more accurately construct the relevant text paragraphs around this concept in the subsequent construction, thereby improving the quality of the government affairs response text.

[0026] Through this process of repeatedly constructing text information, obtaining a set of errors between paragraphs, adaptively updating a set of implicit text representations, and reconstructing text information, the computer system can gradually optimize the generated text information to make it more in line with the requirements of government Q&A, ensuring that the government response text reaches a high level in terms of semantic coherence, accuracy, and completeness. This process reflects the dynamic and adaptive nature of the entire government data Q&A generation method, which can effectively improve the quality of government responses and meet the strict requirements of the government field for information processing and Q&A.

[0027] Step S400: Generate a government affairs response text based on X segments of text information obtained from the last text information construction in multiple text information constructions.

[0028] In step S400 of the embodiment of the present application, the process of multiple text information construction has been performed multiple times in the previous steps (such as step S300). Each construction will generate X paragraphs of text information, and the focus here is on the X paragraphs of text information obtained by the last construction. These text information are obtained after a series of complex operations and optimizations, and contain rich government-related content, and each paragraph of text information corresponds to a paragraph in the government response text.

[0029] For example, assuming X=3, in a government Q&A scenario about urban traffic planning, the first paragraph of text information obtained from the last text information construction may contain an overview of the current status of urban traffic, such as the existing road network layout, public transportation route distribution, and the general situation of traffic flow; the second paragraph of text information may involve the goals and strategies of urban traffic planning, such as the specific plans for adding new roads and improving public transportation services in the next few years; the third paragraph of text information may be about the expected effects after the implementation of the traffic plan, such as estimates of easing traffic congestion and improving residents' travel satisfaction.

[0030] When the computer system generates the government response text, it needs to combine these X paragraphs of text information according to certain rules. This process may involve some format adjustments and optimization of semantic coherence. From the format point of view, the computer system needs to determine the appropriate paragraph separation method. For example, in the plain text format, line breaks are usually used to distinguish different paragraphs, making the government response text clear and concise in form.

[0031] In terms of ensuring semantic coherence, the computer system may use some technical means to check and adjust the transition between adjacent paragraphs. Although the previous steps (such as the operation of obtaining the error set between paragraphs in step S300) have ensured the internal coherence of each paragraph of text information to a certain extent, further optimization is still needed when it is finally combined into the government response text. One possible technical means is based on semantic role labeling (SRL). SRL can identify semantic roles in sentences, such as agent, patient, time, place, etc. The computer system can judge the coherence between them by analyzing the semantic roles in the first and last sentences of adjacent paragraphs. If the semantic roles are found to be incoherent, for example, the "traffic flow" (as the patient) mentioned in the last sentence of the previous paragraph has no reasonable connection relationship in the first sentence of the next paragraph, the computer system can try to adjust the sentence structure or add some connecting sentences to improve this situation. In addition, the computer system may also perform grammar checking and correction on the entire government response text. This can be achieved through grammar analysis tools in natural language processing. For example, a rule-based parser or statistical model (such as a hidden Markov model) is used to check whether the grammatical structure of a sentence is correct. If grammatical errors are found, such as subject-verb inconsistency, incorrect verb tense, etc., the computer system will correct them according to the grammatical rules. At the same time, in order to make the government response text more in line with the expression standards in government scenarios, the computer system may also standardize some terms. In the field of government affairs, there are a large number of specific terms and standardized expressions. For example, in the field of traffic planning, there may be clear classification standards for road types, such as "main roads", "secondary roads", "branch roads", etc. If there are non-standard expressions in the generated text information, the computer system will replace them with standard terms.

[0032] In actual operation, the computer system may use a series of predefined templates or rules to guide the generation of government response texts. These templates can be customized according to different government fields and question types. For example, for government Q&A on policy interpretation, the template may first introduce the background of the policy, then explain the main content of the policy, and finally explain the impact and significance of the policy. The computer system will fill the X paragraphs of text information obtained from the last text information into the corresponding template position to generate a response text that meets government requirements.

[0033] From the perspective of information integrity, the computer system also needs to ensure that the government response text can fully answer government-related questions. This means that important information should not be omitted in the generated text. For example, if the question is about the consideration of environmental protection in transportation planning, then this aspect must be included in the government response text, whether it is elaborated in detail in a certain paragraph or mentioned in multiple paragraphs, the integrity of the information must be guaranteed.

[0034] As an implementation manner, each segment of text information includes text representations of multiple text elements. In step S300, obtaining a set of inter-paragraph errors corresponding to the current X segments of text information may include:

[0035] Step S310: performing text processing on the current X pieces of text information, the text processing including: cleaning up repeated semantic information of the same text element in the X pieces of text information, or filtering the text representation of each text element in each piece of text information;

[0036] Step S320: after text processing, the difference between the two preceding and following text information in the current X text information is determined one by one, and Y inter-paragraph error value arrays are obtained, where Y=X-1; wherein the difference determination includes: determining the error between two text representations of the same text element in the two preceding and following text information;

[0037] Step S330: Based on the Y inter-paragraph error value arrays, generate an inter-paragraph error set corresponding to the currently generated X paragraphs of text information.

[0038] The computer system performs text processing on the current X paragraphs of text information in step S310. This processing process is mainly for preprocessing the text information so that the errors between paragraphs can be determined more accurately later. The text processing here includes two methods: one is to clean up the repeated semantic information of the same text elements in the X paragraphs of text information, and the other is to filter the text representation of each text element in each paragraph of text information.

[0039] In the process of generating government response texts, some identical text elements in X paragraphs of text information may have repeated semantic information. For example, in a government text about urban construction planning, if the text element "infrastructure construction" is mentioned multiple times, each mention may be accompanied by a similar description, such as "Infrastructure construction is crucial to urban development, and we must attach importance to infrastructure construction and continuously promote infrastructure construction." There is repeated semantic information here, and the computer system needs to clean it up.

[0040] The computer system can use semantic analysis technology to identify repeated semantic information of the same text element. One possible way is to build a semantic dictionary and store the text elements and their corresponding semantic information in it. For each text element in X pieces of text information, the computer system searches for its corresponding semantic information in the semantic dictionary. If it is found that the semantic information of the text elements that appear multiple times is highly similar (which can be judged by setting a similarity threshold, such as setting a cosine similarity greater than 0.8 to be considered semantically similar), then one of the text elements and its semantic information is retained, and the other repeated parts are removed. The text representation here refers to a mathematical representation of the text element, such as a vector representation obtained by a word vector model. Filtering the text representation is to remove noise or unnecessary information so that the text representation more accurately reflects the semantic characteristics of the text element.

[0041] Computer systems can use filtering techniques in digital signal processing to filter text representations. For example, a low-pass filter can be used, which allows low-frequency signals to pass through and suppresses high-frequency signals. In the context of text representation, low-frequency signals can be understood as information reflecting the core semantics of text elements, and high-frequency signals may be some noise or unimportant semantic changes. Specifically, assuming that the text representation of a text element is a vector sequence , the computer system can filter this vector sequence through a filter function F to obtain the filtered text representation This filter function can be based on a weighted average, for example, for each vector in the vector sequence , the filtered vector It can be calculated by the following formula: ; where k is the size of the filter window, is the weight coefficient, satisfying In this way, the computer system can filter the text representation of each text element in each piece of text information.

[0042] In step S320, after completing the text processing of step S310, the computer system will determine the difference between the two paragraphs of text information in the current X paragraphs of text information one by one, so as to obtain an array of Y paragraph error values ​​(Y=X-1). This process mainly quantifies the degree of difference between the two paragraphs of text information. The difference determination here is achieved by determining the error between two text representations of the same text element in the two paragraphs of text information. As mentioned above, the text representation is a mathematical representation of the text element. By calculating the error between them, the degree of semantic difference between the two paragraphs of text can be reflected.

[0043] For example, suppose there are two paragraphs of text information about education policy. The first paragraph contains the text element "education equity", and its text is represented as a vector =[0.1, 0.2, 0.3], the second paragraph also contains the text element "educational equity", and its text is represented as a vector =[0.15, 0.22, 0.28]. The computer system can use the Euclidean distance formula to calculate the error between the two vectors (0.0574). The computer system will perform such an error calculation for each identical text element, and then combine these error values ​​into an array of inter-paragraph error values. Since there are X paragraphs of text information, the two paragraphs before and after are compared, so Y=X-1 inter-paragraph error value arrays will be obtained.

[0044] In step S330, the computer system generates a set of inter-paragraph errors corresponding to the currently generated X paragraphs of text information based on the Y inter-paragraph error value arrays obtained in step S320. This set will be used for adaptive updating of the text implicit representation set in subsequent steps.

[0045] Specifically, the computer system establishes an inter-paragraph error value array with all zero elements, and then adds the established inter-paragraph error value array to the front end of the Y inter-paragraph error value arrays, so that the X inter-paragraph error value arrays arranged in order are obtained. Next, the computer system will perform inductive analysis on the X element values ​​of the same text element in the X inter-paragraph error value arrays to obtain the element value adjustment variable of each text element. The inductive analysis here can adopt a variety of methods, such as calculating the average value, median or weighted average value of these element values. Finally, the computer system adjusts the X element values ​​of the corresponding text elements in the X inter-paragraph error value arrays based on the element value adjustment variables of each text element, thereby obtaining the inter-paragraph error set corresponding to the X paragraphs of text information generated at the moment. The adjustment method can also adopt a variety of methods, such as adjusting according to a certain ratio. Through such steps, the computer system completes the generation process from the Y inter-paragraph error value arrays to the inter-paragraph error set, and this inter-paragraph error set will provide an important basis for the adaptive update of the subsequent text implicit representation set, thereby continuously optimizing the generation process of the government affairs response text.

[0046] As an implementation mode, before text processing is performed, the text representation of any text element in each segment of text information represents text semantic information of the corresponding text element; based on this, if the text processing includes cleaning the same text semantic information of the same text element in X segments of text information, then step S310, performing text processing on the current X segments of text information, includes:

[0047] Step S311: Walk through multiple text elements, and determine the text element that is currently walked to as the ath text element, where a is a positive integer not greater than S, and S is the number of text elements;

[0048] Step S312: obtaining a text representation adjustment variable of the ath text element, where the text representation adjustment variable is obtained by summarizing and analyzing the X text representations of the ath text element in the current X segments of text information;

[0049] Step S313: adjusting the X text representations of the a-th text element in the current X segments of text information according to the text representation adjustment variables; wherein the adjustment is to correct the vector value according to the set adjustment method.

[0050] The computer system starts to perform a walk operation on multiple text elements in step S311. Walk here is a way of traversing text elements, by accessing text elements one by one, so as to perform subsequent processing on each text element. The computer system determines the text element that is currently walked to as the ath text element, where a is a positive integer not greater than S, and S is the number of text elements.

[0051] Suppose there is a government response text about urban environmental governance. After a certain text information construction, the X segments of text information obtained contain multiple text elements, such as "air quality", "sewage treatment", "greening construction", "garbage disposal", etc. These text elements together constitute the relevant content in the government response text. Suppose there are a total of S=10 text elements here, and the computer system begins to perform a wandering operation on these text elements. When the system starts wandering, the first text element to arrive is assumed to be "air quality". At this time, the computer system determines this text element as the a=1 text element. As the wandering operation continues, the next text element to arrive will be determined as the a=2 text element, and so on, until all S text elements are traversed.

[0052] In order to implement this wandering operation, the computer system can use an index to manage text elements. In the computer's memory, these S text elements can be stored in a data structure, such as an array or a linked list. If array storage is used, each text element corresponds to an element position in the array, and the computer system can use an index variable to mark the current wandering position. Initially, the index variable is 1, indicating the first text element. As the operation proceeds, the index variable increases by 1 each time until it reaches S, indicating that all text elements have been traversed. This index-based wandering method is simple and direct, and can effectively process text elements one by one.

[0053] In step S312, the computer system obtains the text representation adjustment variable for the ath text element determined in step S311. This text representation adjustment variable is obtained by summarizing and analyzing the X text representations of the ath text element in the current X segments of text information. It is an important basis for the subsequent adjustment of the X text representations of the ath text element.

[0054] The computer system can use a variety of inductive analysis methods to obtain text representation adjustment variables. One feasible method is to calculate the statistics of the X text representations, such as the average, median or weighted average. If the average value is used for calculation.

[0055] In step S313, the computer system adjusts the X text representations of the ath text element in the current X paragraphs of text information according to the text representation adjustment variables obtained in step S312. This adjustment is to correct the vector value according to the set adjustment method, and the purpose is to clean up the repeated semantic information of the same text element in different text paragraphs, so that the text representation more accurately reflects the semantic connotation of the text element, thereby improving the quality of the government response text.

[0056] For example, taking the text element "air quality" as an example, assuming that the text representation adjustment variable has been obtained as , whose original text representations in X=3 pieces of text information are The computer system will adjust the three text representations according to the set adjustment method. In one possible adjustment method, the text representation adjustment variable is used as the average text representation corresponding to the a-th text element. In the above example, is the average text representation of "air quality". Then, the X text representations of the ath text element in the current X text information are walked (this is similar to the walking operation in step S311, but it is aimed at the X text representations of a specific text element). Suppose we walk to .

[0057] Next, confirm With the average text representation The error between the vectors is obtained by calculating the first error result. The error between the vectors can be calculated using the Euclidean distance formula. = , For the above average text representation, the Euclidean distance formula is: ; where n is the dimension of the vector (in this example n=3), and They are vectors and Substituting into the numerical calculation, we can get Finally, based on the ratio between the first error result and the average text representation corresponding to the a-th text element, Assume that the adjustment ratio is k (k can be set according to specific needs, for example, k=0.5), the adjusted vector The calculation method is as follows:

[0058] ;

[0059] in, For vector Calculate the modulus of =0.3742, substitute the value to calculate the adjusted vector .

[0060] The computer system will adjust the other text representations of the ath text element ("air quality") in the same way. Through this adjustment method, the text representation of the same text element in different text paragraphs can be made more reasonable, reducing the impact of repeated semantic information, thereby improving the accuracy and coherence of the government response text. By walking the text elements, obtaining text representation adjustment variables, and adjusting the text representation based on the adjustment variables, it plays an important role in cleaning up the same text semantic information of the same text elements in X paragraphs of text information, which helps to improve the effect of the government data question and answer generation method based on the trusted large model, making the generated government response text more accurate and standardized.

[0061] As an implementation mode, the inductive analysis includes determining the average value, so step S312, obtaining the text representation adjustment variable of the a-th text element, may include:

[0062] Step S3121: obtaining a first filter, the first filter comprising first filter matrices of X dimensions, each of which is a scalar matrix, and the first filter matrices of X dimensions are used to perform average filtering on X text representations of the same text element in the current X segments of text information;

[0063] Step S3122: using a first filter to perform average filtering on the current X segments of text information to obtain a first text filtering representation; wherein the first text filtering representation includes S first filtering results, and the ath first filtering result represents an average result of the X text representations of the ath text element in the current X segments of text information;

[0064] Step S3123: In the first text filtering representation, obtain the ath first filtering result as the text representation adjustment variable of the ath text element.

[0065] The computer system obtains the first filter in step S3121. This first filter is a tool specifically used to perform average filtering on the X text representations of the same text element in the current X segments of text information. It contains a first filter matrix of X dimensions, and each first filter matrix is ​​a scalar matrix. The filter matrix here is a mathematical structure that implements the filtering operation on the text representation through specific matrix operations, and the scalar matrix is ​​a special matrix form whose main diagonal elements are equal and the non-main diagonal elements are zero. This matrix form has a special role in the average filtering operation. For example, suppose that a government response text about education policy is being processed, in which there is a text element called "education equity". In X=3 segments of text information, the text element "education equity" has different text representations (here it is assumed to be represented in vector form). The text representation in the first segment of text information is =[0.1, 0.2, 0.3], the text in the second paragraph is represented as , the text in the third paragraph of text information is represented as In order to perform average filtering on the three text representations, the computer system needs to obtain the first filter. Assume that each first filter matrix of the first filter here is a 1×1 scalar matrix (in this simple example), for example, the first filter matrix corresponding to the first text information is , the second paragraph is , the third paragraph is , and in order to achieve average filtering, you can set .

[0066] The computer system can construct the first filter according to a pre-set rule. In practical applications, if the number of X pieces of text information to be processed is known, the corresponding first filter matrix of X dimensions can be constructed according to the requirements of average filtering. If a matrix operation library (such as the NumPy library in the Python environment) is used, these scalar matrices can be created through code. For example, in Python, to create a 1×1 scalar matrix (corresponding to a filter matrix of one dimension in the above example), the following code can be used:

[0067] import numpy as np

[0068] Create a 1×1 scalar matrix with a value of 1 / 3

[0069] scalar_matrix=np.array([[1 / 3]])

[0070] For multiple dimensions (X dimensions), corresponding filter matrix arrays can be created through loops or vector operations to construct the complete first filter.

[0071] In step S3122, the computer system uses the first filter to perform average filtering on the current X segments of text information, with the purpose of obtaining a first text filter representation. The first text filter representation includes S first filter results, wherein the ath first filter result can represent the average result of the X text representations of the ath text element in the current X segments of text information. Through this average filtering operation, the text representations of the same text element in different text paragraphs can be comprehensively considered to obtain a more representative result.

[0072] Continuing with the above example of “educational equity”, the computer system uses the first filter obtained in step S3121 (here are three 1×1 scalar matrices ) performs average filtering on the three text representations of “education equity”. The specific filtering operation is implemented through matrix multiplication (in this simple case of 1×1 matrix multiplication with vector, it is actually the multiplication and summation of vectors). For the text representation in the first paragraph of text information , the result after filtering is: Similarly, for the text representation in the second paragraph of text information =[0.15, 0.25, 0.35], the result after filtering is [0.05, 0.0833, 0.1167]. For the text representation in the third paragraph of text information =[0.12, 0.22, 0.32], the filtered result is [0.04, 0.0733, 0.1067]. Combining these three filtered results, we get the first text filter representation, that is, [[0.0333, 0.0667, 0.1], [0.05, 0.0833, 0.1167], [0.04, 0.0733, 0.1067]], where we assume that this is the first text filter representation of the text element "education equity" (i.e., the a-th text element), where each subvector is a first filter result.

[0073] In actual matrix operations, if the text representation is a high-dimensional vector (for example, in more complex natural language processing models, the vector dimension may reach hundreds or even thousands), and the filter matrix may also be a higher-dimensional matrix (although it is a simple 1×1 scalar matrix in this example, it may be other dimensions in more general cases), the computer system can use efficient linear algebra libraries for operations. For example, using the NumPy library in Python, for the vector \vec{v} and the filter matrix K (assuming the dimensions match), `np.dot(K, v)` can be used to implement matrix multiplication operations to complete the filtering. For batch processing of multiple text representations, loops or vectorized operations can be used to improve computational efficiency.

[0074] In step S3123, the computer system obtains the ath first filtering result in the first text filtering representation as the text representation adjustment variable of the ath text element. This text representation adjustment variable will be used to adjust the X text representations of the ath text element in subsequent steps (such as step S313), thereby optimizing the text information, making the representation of the same text element in different text paragraphs more reasonable, and reducing problems such as repeated semantics.

[0075] In the above example of "educational equity", the first text filter is represented as [[0.0333, 0.0667, 0.1], [0.05, 0.0833, 0.1167], [0.04, 0.0733, 0.1067]]. If "educational equity" is determined as the a-th text element, then the a-th first filtering result here (assuming that according to the previous order, a=1 corresponds to the first sub-vector) is [0.0333, 0.0667, 0.1]. The computer system uses this vector as the text representation adjustment variable of the text element "educational equity".

[0076] As an implementation manner, the text representation adjustment variable includes an average result of X text representations of the ath text element in the current X segments of text information; based on this, step S313, adjusting the X text representations of the ath text element in the current X segments of text information according to the text representation adjustment variable, may include:

[0077] Step S3131: taking the average result of the X text representations of the a-th text element in the current X segments of text information as the average text representation corresponding to the a-th text element;

[0078] Step S3132: Walk through the X text representations of the a-th text element in the current X segments of text information, and use the currently walked text representation as the x-th text representation;

[0079] Step S3133: determining the error between the x-th text representation and the average text representation corresponding to the a-th text element, and obtaining a first error result;

[0080] Step S3134: Based on the ratio between the first error result and the average text representation corresponding to the a-th text element, adjust the x-th text representation.

[0081] In step S3131, the computer system uses the average result of the X text representations of the a-th text element in the current X paragraphs of text information as the average text representation corresponding to the a-th text element. The average text representation here is an important reference value for subsequent adjustment operations. It integrates the text representation information of the a-th text element in different text paragraphs and reflects an average semantic feature of the text element in the overall text information.

[0082] Assume that in a government response text about urban planning, the ath text element is "public transportation facilities". In X=3 text messages, the text representations of the text element "public transportation facilities" are respectively (represented in vector form): the text representation in the first text message is [0.1, 0.2, 0.3], the text representation in the second text message is [0.12, 0.23, 0.35], and the text representation in the third text message is [0.08, 0.18, 0.25]. The computer system first calculates the average results of these three text representations, and then calculates the average by adding the vectors and then calculating the average. The average result is [0.1, 0.2033, 0.3], and the computer system uses it as the average text representation corresponding to the ath text element "public transportation facilities".

[0083] In step S3132, the computer system walks through the X text representations of the a-th text element in the current X paragraphs of text information, and uses the currently walked text representation as the x-th text representation. The walking operation here is similar to traversing and accessing the elements in an array or list, and the text representations of the a-th text element in different text paragraphs are accessed one by one, so that each text representation can be adjusted separately later.

[0084] Continuing with the above example of "public transportation facilities", the computer system starts to walk the three text representations ([0.1, 0.2, 0.3], [0.12, 0.23, 0.35], [0.08, 0.18, 0.25]). Assume that it walks to [0.1, 0.2, 0.3] first, then the computer system uses this vector as the xth text representation (here x=1, indicating the first text representation walked to).

[0085] In computer programs, loop structures can be used to implement this kind of walk operation. Taking Python as an example, if the three text representations are stored in a list, such as `text_representations=[np.array([0.1, 0.2,0.3]), np.array([0.12, 0.23, 0.35]), np.array([0.08, 0.18, 0.25])]`, the following code can be used for the walk operation:

[0086] for index, representation in enumerate(text_representations):

[0087] The text currently visited is represented as representation

[0088] index represents the current index (i.e. the value of x)

[0089] pass

[0090] In step S3133, the computer system determines the error between the xth text representation and the average text representation corresponding to the ath text element to obtain a first error result. This error calculation is to quantify the degree of difference between the two, thereby providing a basis for subsequent adjustment operations based on the error ratio.

[0091] Still taking "public transportation facilities" as an example, assuming that the xth text is represented by \vec{v}_{1}=[0.1, 0.2,0.3], and the average text corresponding to the ath text element is represented by \vec{m}=[0.1, 0.2033, 0.3]. The computer system can use the Euclidean distance formula to calculate the error between these two vectors.

[0092] In addition to the Euclidean distance formula, other distance measurement methods can be used to calculate the error according to actual needs, such as the Manhattan distance formula. In programming implementation, the corresponding function can be written according to the selected distance measurement method.

[0093] In step S3134, the computer system adjusts the xth text representation based on the ratio between the first error result and the average text representation corresponding to the ath text element. This adjustment method is to modify the original text representation based on the relative relationship between the two, with the purpose of making the text representation more reasonable, reducing the semantic differences of the same text element in different text paragraphs, and improving the accuracy and coherence of the government response text. Continuing with the above example, the first error result is , the average text corresponding to the a-th text element is expressed as Assume that the adjustment ratio is k=0.5 (this ratio can be set according to the specific situation to control the amplitude of the adjustment).

[0094] First, calculate the ratio between the first error result and the average text representation: ; Then for the xth text, After adjustment, the adjusted vector for: = ; The computer system will adjust other text representations of the ath text element in the same manner.

[0095] In programming implementation, the above calculation process can be completed in a loop structure (such as the loop structure in step S3132). According to different programming languages ​​and data structures, vector operations and numerical calculations need to be performed reasonably. For example, in Python, the entire adjustment process can be easily implemented by combining the previously mentioned NumPy library and the custom distance calculation function.

[0096] As another implementation, the text representation adjustment variable includes the maximum text representation and the minimum text representation of the X text representations of the a-th text element in the current X segments of text information; step S313, adjusting the X text representations of the a-th text element in the current X segments of text information according to the text representation adjustment variable, may include:

[0097] Step S313a: determining an error between a maximum text representation and a minimum text representation among the X text representations of the a-th text element in the current X segments of text information, and obtaining a second error result;

[0098] Step S313b: for the xth text representation among the X text representations, determine the error between the xth text representation and the minimum text representation, and adjust the xth text representation based on the ratio between the determined error and the second error result.

[0099] In step S313a, the computer system determines the error between the maximum text representation and the minimum text representation among the X text representations of the a-th text element in the current X paragraphs of text information, thereby obtaining a second error result. The maximum text representation and the minimum text representation are obtained after comparing all text representations of the a-th text element in the X paragraphs of text information, and the error between them is a quantitative indicator for measuring the degree of difference in the semantic representation of the text element in different text paragraphs.

[0100] Suppose that in a government response text about environmental protection policy, the ath text element is "pollutant emission reduction". In X=4 pieces of text information, the text representation (in vector form) of the text element "pollutant emission reduction" is: the text representation in the first piece of text information is [0.1, 0.2, 0.3], the text representation in the second piece of text information is [0.12, 0.23, 0.35], the text representation in the third piece of text information is [0.08, 0.18, 0.25], and the text representation in the fourth piece of text information is [0.15, 0.28, 0.38].

[0101] The computer system first finds the largest and smallest vectors among the four vectors. By comparing the values ​​of each component, it can be determined that the largest vector is [0.15, 0.28, 0.38] and the smallest vector is [0.08, 0.18, 0.25].

[0102] The computer system then calculates the error between the two vectors, using the Euclidean distance formula. Substituting the numerical value into the calculation, the result is 0.178, which is the second error result.

[0103] In order to find the largest and smallest text representations (vectors), the computer system can use a traversal comparison method. In programming implementation, if a programming language such as Python is used, a loop structure can be used to traverse all vectors. For example, store these vectors in a list:

[0104] vectors=[np.array([0.1, 0.2, 0.3]), np.array([0.12, 0.23, 0.35]),np.array([0.08, 0.18, 0.25]), np.array([0.15, 0.28, 0.38])]

[0105] max_vector = vectors[0]

[0106] min_vector = vectors[0]

[0107] for vector in vectors[1:]:

[0108] for i in range(len(vector)):

[0109] if vector[i]>max_vector[i]:

[0110] max_vector=vector

[0111] elif vector[i] <min_vector[i]:

[0112] min_vector=vector

[0113] In addition to the manual calculation method mentioned above, you can also use functions in some scientific computing libraries to calculate the Euclidean distance. For example, in Python, the `linalg.norm` function of the NumPy library can be used to conveniently calculate the distance between vectors. Assuming that `max_vector` and `min_vector` are already available, the distance can be calculated as follows:

[0114] import numpy as np

[0115] distance=np.linalg.norm(max_vector-min_vector)

[0116] In step S313b, the computer system determines the error between the xth text representation and the minimum text representation for the xth text representation among the X text representations, and then adjusts the xth text representation based on the ratio between the determined error and the second error result. This adjustment method is based on the relative error relationship between the xth text representation and the minimum text representation, relative to the error between the overall maximum and minimum text representations (the second error result), to correct the xth text representation to optimize the text representation, thereby improving the quality of the government response text.

[0117] Continuing with the above "pollution reduction" example, we have obtained the maximum vector [0.15, 0.28, 0.38], the minimum vector [0.08, 0.18, 0.25], and the second error result is about 0.178. Suppose now we want to adjust the x=1 text representation [0.1,0.2, 0.3]. First, the computer system calculates the error between [0.1, 0.2, 0.3] and the minimum vector, and also uses the Euclidean distance formula to get 0.057, and then calculates the ratio between this error and the second error result: ; Assuming the adjustment coefficient is k=0.5 (this coefficient can be set according to the specific situation to control the amplitude of the adjustment), adjust the x-th text representation [0.1, 0.2, 0.3]. The adjusted vector is calculated as follows: = .

[0118] The computer system will adjust the other text representations of the ath text element (when x=2, x=3, x=4) in the same manner.

[0119] In programming implementation, the entire process can be completed in a loop structure, traversing all X text representations. When calculating the error and ratio, as mentioned earlier, you can use custom functions or functions in scientific computing libraries. For example, in Python, using the NumPy library for vector operations and combining it with a loop structure can efficiently implement this adjustment process. The following is a simple pseudocode example:

[0120] Assume that vectors is a list storing X text representations, min_vector and max_vector are already determined, and k is the adjustment coefficient

[0121] for x in range(len(vectors)):

[0122] Calculate the error between the current vector and the minimum vector

[0123] error_with_min=calculate_distance(vectors[x], min_vector)

[0124] Calculate the ratio

[0125] ratio=error_with_min / second_error_result

[0126] Adjust the current vector

[0127] vectors[x]=vectors[x]+ k * ratio * (max_vector-min_vector)

[0128] The calculate_distance function can be the function mentioned above for calculating the Euclidean distance.

[0129] In summary, steps S313a-S313b adjust the X text representations of the a-th text element by determining the error between the maximum and minimum text representations and the error ratio between a single text representation and the minimum text representation. This adjustment method helps to optimize the text representation of the same text element in different text paragraphs and reduce semantic differences during the generation of government data questions and answers, thereby improving the accuracy, coherence and quality of government response texts and meeting the strict requirements of information processing in the government field.

[0130] As an implementation mode, when the multiple text elements have completed wandering, step S310, performing text processing on the current X segments of text information, may also include:

[0131] Step S314: obtaining a second filter, the second filter comprising a second filter matrix of X dimensions, the size of each second filter matrix is ​​n×1, n≥2; the second filter matrix of the xth dimension is used to perform average filtering on the xth segment of text information;

[0132] Step S315: using a second filter to perform average filtering on the current X segments of text information to obtain X second text filter representations; wherein each second text filter representation includes T second filter results, T≥1, and the t-th second filter result in the x-th second text filter representation represents the average result of each text representation in the t-th range of size n×1 in the x-th segment of text information, and t is not greater than T;

[0133] Step S316: adjusting the t-th second filtering result in the X second text filtering representations to obtain X adjusted second filtering results;

[0134] Step S317: in the xth piece of text information included in the current X pieces of text information, all text representations in the tth range of size n×1 are adjusted to the xth adjusted second filtering result.

[0135] The computer system obtains a second filter in step S314. This second filter is a tool designed specifically for average filtering of the current X segments of text information. It contains a second filter matrix of X dimensions, and the size of each second filter matrix is ​​n×1 (n≥2). The filter matrix here is a mathematical structure, and its function is to process the text representation in the text information through a specific matrix operation to achieve a filtering effect. In this process, the second filter matrix of the xth dimension is used to average filter the xth segment of text information.

[0136] Suppose we are processing a government response text about medical and health policy, where X=3 paragraphs of text information. For each paragraph of text information, it contains multiple text elements, and each text element has its text representation (here it is assumed to be represented in vector form). For example, the first paragraph of text information has the text element "medical resource allocation", and its text representation is [0.1, 0.2, 0.3, 0.4], the second paragraph of text information has the text element "medical security system", and its text representation is [0.12, 0.23, 0.35, 0.45], and the third paragraph of text information has the text element "medical and health service quality", and its text representation is [0.08, 0.18, 0.25, 0.35].

[0137] In order to filter these text information, the computer system obtains a second filter. Assuming that n=4, the second filter matrix corresponding to the first text information is: ; The second filter matrix corresponding to the second paragraph of text information is: ; The second filter matrix corresponding to the third paragraph of text information is: The settings of these filter matrices are determined according to specific filtering requirements, and different matrix element values ​​will have different effects on the filtering results.

[0138] The computer system can construct the second filter according to a pre-set filtering strategy. In actual operation, if the number of paragraphs X of text information to be processed and the dimension n of each filter matrix are known, these filter matrices can be created according to specific algorithms or rules. For example, in some cases, the element values ​​of the filter matrix can be determined based on the importance of the text paragraphs or the distribution characteristics of the text elements. If a matrix operation library (such as the NumPy library in the Python environment) is used, these filter matrices can be created by writing code. The following is a simple Python code example for creating a simple n×1 filter matrix (taking n=4 as an example):

[0139] import numpy as np

[0140] Create a 4x1 filter matrix

[0141] filter_matrix=np.array([[0.25], [0.25], [0.25], [0.25]])

[0142] For constructing the second filter of X dimensions, a corresponding filter matrix array may be created by loop or vector operation.

[0143] In step S315, the computer system uses the second filter to perform average filtering on the current X segments of text information, thereby obtaining X second text filter representations. Each second text filter representation includes T second filter results, where T≥1, and the t-th second filter result in the x-th second text filter representation can represent the average result of each text representation in the t-th range of size n×1 in the x-th segment of text information. This average filtering operation helps to comprehensively consider various parts of the text information, so that the filtered result can better reflect the overall characteristics of the text.

[0144] Let’s continue with the above-mentioned government response text of medical and health policy as an example. For the first paragraph of text information, there are text representations of multiple text elements (assuming that there are other text elements in addition to the “medical resource allocation” mentioned above). These text representations are arranged in order into a matrix form (here it is assumed to be a 4×m matrix, where m is the number of text elements), and then compared with the corresponding second filter matrix Perform matrix multiplication. Assume that the text representation matrix of all text elements in the first paragraph of text information is: ;

[0145] Through matrix multiplication , the result is the second text filter representation of the first text information. The calculation process is as follows: ;

[0146] This result matrix is ​​the second text filtering representation of the first text message, in which each element is a second filtering result. Similarly, for the second and third text messages, respectively, the corresponding second filtering matrices and Perform matrix multiplication operations to obtain respective second text filter representations. In actual matrix operations, if Python's NumPy library is used, matrix multiplication operations can be performed efficiently. For arranging the text representation in matrix form, corresponding organization can be performed according to the order and number of text elements. When calculating the average filtering result, matrix multiplication can automatically perform weighted summation on the text representation according to the set filtering matrix to obtain the average result in each range. In step S316, the computer system adjusts the t-th second filtering result of the X second text filtering representations obtained in step S315 to obtain X adjusted second filtering results. This adjustment operation is to further optimize the filtered text representation to make it more in line with the requirements of the government response text, which may be based on certain predefined rules or to meet specific semantic features.

[0147] Assume that in the above example of medical and health policy, the second text filter for the first text message is represented as [0.2, 0.23, 0.25, 0.28] (here it is assumed that these are 4 second filter results), and for a predefined adjustment rule, for example, each second filter result is linearly adjusted, and the adjustment coefficient is k=0.5. Then the adjusted second filter result is: ;

[0148] Likewise, the t-th second filtering result in the second text filtering representation of the second and third sections of text information is adjusted according to the same rule.

[0149] The adjustment operation can use different technical means according to the specific adjustment rules. If it is a simple linear adjustment, such as multiplying by a coefficient in the above example, the multiplication operation can be performed directly in the program. If the adjustment rule is more complex, such as adjustment based on other text features or model prediction results, additional calculation or query operations may be required. In programming implementation, conditional statements or function calls can be used to implement different adjustment rules.

[0150] In step S317, the computer system adjusts each text representation in the t-th range of size n×1 in the x-th text information included in the current X-th text information to the x-th adjusted second filtering result. The purpose of this is to adjust the original text representation so that each text information is more unified and optimized after filtering and adjustment, reduce noise or unnecessary changes in the text representation, and thus improve the quality of the government response text.

[0151] Continuing with the example of the medical and health policy above, assume that the text in the t=1th n×1 (here n=4) range in the first paragraph of text information is represented as (previously assumed) [0.1, 0.2, 0.3, 0.4]. After the previous steps, the first second filtering result after the adjustment of the first paragraph of text information is obtained as .

[0152] Then the computer system will The range is adjusted to [0.3, 0.3, 0.3, 0.3], that is, all text representations within this range are adjusted to the adjusted second filtering result. Similarly, other ranges of size n×1 in the first paragraph of text information, as well as the corresponding ranges in the second and third paragraphs of text information, are adjusted in this way.

[0153] In programming implementation, this adjustment can be achieved through indexing and assignment operations. If the text representation is stored in a matrix or array structure, the corresponding text representation can be found according to the definition of the range (for example, by determining the start and end indexes), and then its value is replaced with the adjusted second filtering result. For example, in Python, if the text representation is stored in a two-dimensional array, loops and indexing operations can be used to traverse each range in each paragraph and replace the value.

[0154] In summary, steps S314-S317 perform comprehensive text processing on the current X segments of text information by obtaining the second filter, performing average filtering, adjusting the filtering results, and adjusting the original text representation. This helps to optimize the text representation in the government response text, improve the quality and accuracy of the text information, and make it more in line with the requirements of government data question and answer generation, which plays an important role in the entire government data question and answer generation method based on a trusted large model.

[0155] As an implementation mode, if the text processing includes filtering the text representation of each text element in each piece of text information, then step S310, performing text processing on the current X pieces of text information, may include:

[0156] Step S3101: obtaining a third filter, where the third filter includes a third filter matrix of one dimension, and the size of the third filter matrix is ​​k×1, where k≥2;

[0157] Step S3102: sequentially access the current X pieces of text information to determine the xth piece of text information currently being accessed;

[0158] Step S3103: using a third filter to perform average filtering on the x-th text information to obtain E third filtering results, where E≥1, and the e-th third filtering result represents the average result of each text representation in the e-th range of size k×1 in the x-th text information, and e is not greater than E;

[0159] Step S3104: In the x-th piece of text information, each text representation in the e-th range of size k×1 is adjusted to the e-th third filtering result.

[0160] The computer system obtains a third filter in step S3101. The third filter is a tool designed specifically for filtering the text representation in each piece of text information. It contains a third filter matrix of 1 dimension, and the size of the third filter matrix is ​​k×1 (k≥2). The filter matrix here is a mathematical structure that implements the filtering function by performing specific matrix operations with the text representation. The setting of its dimension and element value is determined according to the filtering requirements and strategies.

[0161] Suppose there is a government response text about education policy, in which a certain section of text information contains multiple text elements, such as "balanced education resources", "improved education quality", "guarantee of education equity", etc. Each text element has its corresponding text representation (assuming it is represented in vector form). In order to filter the text representation of these text elements, the computer system needs to obtain the third filter. Assuming k=3 here, the third filter matrix can be expressed as: ; The element values ​​of this filter matrix represent the weight distribution of different parts during the filtering process. For example, 0.4 means that a relatively large weight is given to a certain part of the text representation, while 0.3 means that a relatively small weight is given to other parts. This weight distribution is set based on the understanding of the text representation structure and the filtering goal.

[0162] The computer system can construct the third filter according to a pre-set filtering strategy. If a matrix operation library (such as the NumPy library in the Python environment) is used, this filter matrix can be created by writing code. For example, the following is a simple Python code example:

[0163] import numpy as np

[0164] Create a 3x1 filter matrix

[0165] filter_matrix=np.array([[0.4], [0.3], [0.3]])

[0166] In practical applications, the element values ​​of the filter matrix can be determined according to specific text features, semantic relationships or analysis results of historical data to achieve a more effective filtering effect.

[0167] In step S3102, the computer system sequentially accesses the current X pieces of text information and determines the currently accessed xth piece of text information. This step is to process each piece of text information separately, ensuring that the filtering process can be operated according to the specific situation of each piece of text information, thereby improving the accuracy and effectiveness of the entire text processing.

[0168] Continuing with the above-mentioned government response text of the education policy as an example, assume that X=3, that is, there are three paragraphs of text information. The computer system begins to access these three paragraphs of text information in sequence. When the first paragraph of text information is accessed, at this time x=1, the computer system determines that the first paragraph of text information is currently being processed, which contains the aforementioned "balanced education resources", "improved education quality", "education equity guarantee" and other text elements and their corresponding text representations. Then, the computer system will perform subsequent filtering operations on this first paragraph of text information. After completing the processing of the first paragraph of text information, it will continue to access the second paragraph of text information (x=2), and so on.

[0169] In programming implementation, you can use a loop structure to access X pieces of text information in sequence. For example, in Python, if you store X pieces of text information in a list structure, you can use a `for` loop to traverse the list. The following is a simple example code:

[0170] text_information=[text_info_1, text_info_2, text_info_3] Assume this is a list storing X pieces of text information

[0171] for x in range(len(text_information)):

[0172] current_text_info=text_information[x]

[0173] Here you can perform subsequent filtering operations on current_text_info

[0174] In step S3103, the computer system uses the third filter to perform average filtering on the x-th paragraph of text information, thereby obtaining E third filtering results. The average filtering operation here is achieved by performing a specific matrix operation on the third filtering matrix and the text representation in the x-th paragraph of text information. Each third filtering result can represent the average result of each text representation in the e-th range of size k×1 in the x-th paragraph of text information, where E≥1 and e is not greater than E. This filtering method helps to extract the main features in the text representation, reduce noise and unnecessary changes, and thus optimize the text representation. Assume that it has been determined that the first paragraph of text information (x=1) in the above-mentioned education policy government affairs response text is to be processed, and there are text representations of multiple text elements in this paragraph of text information (assuming that these text representations are arranged in matrix form, and to simplify the example, it is assumed to be a 3×3 matrix): ; Use the third filter matrix obtained previously Perform average filtering. The calculation process is as follows: ; The three results obtained here are the three third filtering results. Assuming E=3, the first third filtering result 0.19 represents the average result of each text representation in the first range of size k×1 (here k=3) in the first paragraph of text information, the second third filtering result 0.24 represents the average result in the second range, and the third third filtering result 0.17 represents the average result in the third range. In actual matrix operations, if Python's NumPy library is used, matrix multiplication operations can be performed efficiently. In programming implementation, it is necessary to correctly perform matrix multiplication operations according to the actual storage structure of the text representation (such as matrix or array). For processing text representation matrices of different sizes, the correct filtering operation can be ensured by dynamically adjusting the index and calculation range.

[0175] In step S3104, the computer system adjusts each text representation in the e-th range of size k×1 in the x-th text information to the e-th third filtering result. The purpose of this is to make the text representation in the x-th text information more concise and accurate, and better reflect the main features of the text, by replacing the original text representation with the filtered result, thereby improving the quality of the government response text.

[0176] Continuing with the above example of education policy, in the first paragraph of text information, it is assumed that three third filtering results have been obtained (as calculated above): 0.19, 0.24, 0.17. If the text representations in the first range of size k×1 (k=3) (assuming that they correspond to the first column in the previous matrix) are 0.1, 0.15, 0.08, then the computer system will adjust these text representations to 0.19. Similarly, for 0.2, 0.25, 0.18 in the second range (assuming that they correspond to the second column in the matrix), they will be adjusted to 0.24, and for 0.3, 0.35, 0.28 in the third range (assuming that they correspond to the third column in the matrix), they will be adjusted to 0.17.

[0177] In programming implementation, this adjustment can be achieved through indexing and assignment operations. If the text representation is stored in a matrix or array structure, the corresponding text representation can be found according to the definition of the range (for example, by determining the start and end indexes), and then its value is replaced with the corresponding third filtering result. For example, in Python, if the text representation is stored in a two-dimensional array, loops and indexing operations can be used to traverse each range and replace the value. The following is a simple pseudocode example:

[0178] Assume that text_matrix is ​​a two-dimensional array storing the text representation of the xth paragraph of text information

[0179] for e in range(E):

[0180] start_index=e * k

[0181] end_index=(e + 1) * k

[0182] for i in range(len(text_matrix)):

[0183] text_matrix[i][start_index:end_index]=third_filter_result[e]

[0184] In summary, steps S3101-S3104 filter the text representation of each text element in each section of text information by obtaining the third filter, accessing the text information in sequence, performing average filtering, and adjusting the text representation. This helps to optimize the text representation in the government response text, improve the quality and accuracy of the text information, and make it more in line with the requirements of government data question and answer generation based on a trusted large model.

[0185] As an implementation manner, step S330, based on the Y inter-paragraph error value arrays, generates an inter-paragraph error set corresponding to the currently generated X paragraphs of text information, which may include:

[0186] Step S331: creating an inter-paragraph error value array with all zero elements, and adding the created inter-paragraph error value array to the front of Y inter-paragraph error value arrays to obtain X inter-paragraph error value arrays arranged in sequence;

[0187] Step S332: performing inductive analysis on the X element values ​​of the same text element in the X inter-paragraph error value arrays to obtain an element value adjustment variable of each text element;

[0188] Step S333: adjusting the X element values ​​of the corresponding text elements in the X inter-paragraph error value arrays based on the element value adjustment variables of each text element, and obtaining an inter-paragraph error set corresponding to the currently generated X paragraphs of text information; wherein the adjustment is to perform vector value correction according to a set adjustment method.

[0189] In step S331, the computer system first creates an inter-paragraph error value array with all zero elements, and then adds this array to the front of the Y inter-paragraph error value arrays, thereby obtaining X inter-paragraph error value arrays arranged in sequence. The purpose of this step is to provide a complete and orderly structure for subsequent inductive analysis, ensuring that each text element can be treated uniformly in the analysis and processing of inter-paragraph errors.

[0190] Assume that in a scenario of generating government response texts about urban construction, there are X=4 paragraphs of text information, then according to the definition Y=X-1=3. Assume that three arrays of inter-paragraph error values ​​have been obtained through the previous steps, which are:

[0191] Array A: [0.1, 0.2, 0.3], corresponding to the error between the first and second paragraphs of text information, where each element may represent the error value of different text elements in the two paragraphs;

[0192] Array B: [0.05, 0.15, 0.25], corresponding to the error between the second and third paragraphs of text information;

[0193] Array C: [0.12, 0.18, 0.22], corresponding to the error between the third and fourth paragraphs of text information.

[0194] The computer system first creates an array of inter-paragraph error values ​​with all zero elements. Assuming that the length of each array is determined by the number of text elements, here it is assumed to be 3 elements, then the created array of all zeros is: [0, 0, 0]. Then this array of all zeros is added to the front of the previous three arrays, and X=4 arrays of inter-paragraph error values ​​arranged in order are obtained: [[0, 0, 0], [0.1, 0.2, 0.3], [0.05, 0.15, 0.25], [0.12, 0.18, 0.22]].

[0195] In programming implementation, the computer system can use an array or list structure to represent these inter-paragraph error value arrays. Taking Python as an example, if a list structure is used, step S331 can be implemented in the following way:

[0196] Assume that we have obtained an array of Y inter-paragraph error values:

[0197] array_a=[0.1, 0.2, 0.3]

[0198] array_b=[0.05, 0.15, 0.25]

[0199] array_c=[0.12, 0.18, 0.22]

[0200] Create an array of all zero elements for the inter-paragraph error values:

[0201] zero_array = [0] * len(array_a)

[0202] Add an array of all zeros to the front:

[0203] new_array=[zero_array] + [array_a, array_b, array_c]

[0204] In step S332, the computer system summarizes and analyzes the X element values ​​of the same text element in the X arrays of inter-paragraph error values ​​arranged in sequence, thereby obtaining the element value adjustment variable of each text element. This summary analysis is to comprehensively consider the overall situation of the error between different paragraphs of each text element, so as to provide a basis for subsequent adjustment operations.

[0205] Continuing with the above example of urban construction, for the X=4 inter-paragraph error value arrays arranged in sequence: [[0, 0,0], [0.1, 0.2, 0.3], [0.05, 0.15, 0.25], [0.12, 0.18, 0.22]]. Assume that each element here corresponds to the error value of a text element, and the element values ​​of the first text element in these four inter-paragraph error value arrays are 0, 0.1, 0.05, and 0.12 respectively.

[0206] The computer system can use a variety of inductive analysis methods, such as calculating average values. For this first text element, its element value adjustment variable (average value) is: (0 + 0.1 + 0.05 + 0.12) / 4 = 0.0675. Similarly, for other text elements (such as 0, 0.2, 0.15, 0.18 corresponding to the second text element, and 0, 0.3, 0.25, 0.22 corresponding to the third text element), such average value calculations are also performed to obtain their respective element value adjustment variables.

[0207] In programming implementation, if Python is used, for the operation of calculating the average, a loop can be used to iterate over the X element values ​​corresponding to each text element. The following is a simple example code snippet, assuming that the array of paragraph error values ​​is stored in a two-dimensional list `paragraph_error_arrays`:

[0208] num_text_elements=len(paragraph_error_arrays[0])

[0209] element_value_adjustment_variables=[]

[0210] for i in range(num_text_elements):

[0211] sum_value=0

[0212] for array in paragraph_error_arrays:

[0213] sum_value += array[i]

[0214] adjustment_variable=sum_value / len(paragraph_error_arrays)

[0215] element_value_adjustment_variables.append(adjustment_variable)

[0216] In addition to average calculation, other inductive analysis methods can also be used, such as median calculation. If you want to calculate the median, you can first sort the X element values ​​corresponding to each text element, and then determine the median based on the parity of X. For example, if X is an odd number, the median is the middle value after sorting; if X is an even number, the median is the average of the two middle numbers. In Python, you can use built-in sorting functions (such as `sorted()`) to implement sorting operations.

[0217] In step S333, the computer system adjusts the X element values ​​of the corresponding text elements in the X inter-paragraph error value arrays based on the element value adjustment variables of each text element, thereby obtaining an inter-paragraph error set corresponding to the currently generated X paragraphs of text information. This adjustment operation corrects the inter-paragraph error value based on the results obtained by the previous inductive analysis, so that the representation of the inter-paragraph error is more accurate and reasonable, thereby providing a more reliable basis for the subsequent adaptive update of the text implicit representation set.

[0218] Continuing with the above example of urban construction, the element value adjustment variable of each text element has been obtained. Assume that the element value adjustment variable for the first text element is 0.0675. For the element values ​​0, 0.1, 0.05, and 0.12 corresponding to the first text element in the X=4 inter-paragraph error value array, it is assumed that the adjustment method is to add a certain proportion of the difference between the adjustment variable and the original value (here the proportion is assumed to be 0.5).

[0219] For the first value 0:

[0220] The difference is 0.0675-0=0.0675, and the adjusted value is 0 + 0.5×0.0675=0.03375.

[0221] For the second value 0.1:

[0222] The difference is 0.0675-0.1=-0.0325, and the adjusted value is 0.1 + 0.5×(-0.0325)=0.08375.

[0223] For the third value 0.05:

[0224] The difference is 0.0675-0.05=0.0175, and the adjusted value is 0.05 + 0.5×0.0175=0.05875.

[0225] For the fourth value 0.12:

[0226] The difference is 0.0675-0.12=-0.0525, and the adjusted value is 0.12 + 0.5×(-0.0525)=0.09375.

[0227] This completes the adjustment of the element value of the first text element in the X inter-paragraph error value array. In the same way, adjust the other text elements to finally obtain the adjusted inter-paragraph error value array, which constitutes the inter-paragraph error set corresponding to the X paragraphs of text information generated at the moment. In programming implementation, nested loops can be used to traverse each text element and the corresponding element in each inter-paragraph error value array. The following is a simple Python example code, based on the previous example code for calculating element value adjustment variables:

[0228] adjustment_ratio=0.5

[0229] for i in range(len(element_value_adjustment_variables)):

[0230] adjustment_variable=element_value_adjustment_variables[i]

[0231] for j in range(len(paragraph_error_arrays)):

[0232] original_value=paragraph_error_arrays[j][i]

[0233] difference=adjustment_variable-original_value

[0234] paragraph_error_arrays[j][i]=original_value + adjustment_ratio* difference

[0235] In summary, steps S331-S333 generate a set of inter-paragraph errors corresponding to the currently generated X paragraphs of text information by establishing an ordered array of inter-paragraph error values, performing inductive analysis, and adjusting operations based on the analysis results. This process is of great significance in the embodiment of the present application, as it provides an accurate basis for the adaptive update of the subsequent text implicit representation set, and helps to improve the quality and accuracy of the generated government response text.

[0236] As an implementation manner, the inter-paragraph error set includes one or more inter-paragraph error value arrays, one inter-paragraph error value array corresponds to a segment of text information, and any inter-paragraph error value array represents the error between the corresponding segment of text information and an adjacent segment of text information; based on this, in step S300, adaptively updating one or more text implicit representations in the text implicit representation set according to the inter-paragraph error set may include:

[0237] Step S340: walking through each inter-paragraph error value array in the inter-paragraph error set, and determining a segment of text information corresponding to the inter-paragraph error value array currently walked to as the target segment of text information;

[0238] Step S350: Extracting the implicit text representation used to construct the target segment text information from the text implicit representation set as the target text implicit representation.

[0239] In step S340, the computer system performs a walk operation on each inter-paragraph error value array in the inter-paragraph error set. The walk here is a traversal method, which accesses the inter-paragraph error value arrays one by one so as to perform subsequent processing on each inter-paragraph error value array. During the walk, the computer system determines a section of text information corresponding to the inter-paragraph error value array that is currently walked to as the target section of text information. This step is the basis for the subsequent adaptive update of the implicit representation of the text. By determining the target section of text information, the implicit representation of the text used to construct the section of text information can be updated in a targeted manner.

[0240] Assume that in a scenario of generating a government response text about agricultural policy, the inter-paragraph error set contains three inter-paragraph error value arrays, which correspond to the error relationship between the three paragraphs of text information in the government response text. For example, the first inter-paragraph error value array corresponds to the error between the first and second paragraphs of text information, the second corresponds to the second and third paragraphs, and the third corresponds to the third and first paragraphs (forming a circular relationship to comprehensively evaluate the text coherence). When the computer system starts the walk operation, it first walks to the first inter-paragraph error value array. At this time, according to the mapping relationship, the first paragraph of text information corresponding to this inter-paragraph error value array is determined as the target paragraph text information. As the walk operation continues, the text information corresponding to the next inter-paragraph error value array that is walked to will become the new target paragraph text information, and so on, until all inter-paragraph error value arrays are traversed. The computer system can implement this walk operation by means of indexes or pointers. For example, an index list can be established for the inter-paragraph error value array, with the initial index being 0, and the index value is increased by 1 for each walk operation until the index value reaches the number of inter-paragraph error value arrays minus 1. At the same time, through a mapping table or rule, each paragraph error value array is associated with the corresponding text information, so that the target paragraph text information can be determined according to the current index. This method is a feasible method for sequential traversal and associative data in data structure and algorithm design.

[0241] In step S350, the computer system extracts the text implicit representation used to construct the target segment text information from the text implicit representation set, and uses it as the target text implicit representation. The text implicit representation set is generated in the previous step (such as step S200), where each text implicit representation is related to the government knowledge text and is used to guide the construction of a paragraph in the government response text. By extracting the target text implicit representation, the computer system clarifies the object that needs to be adaptively updated so that it can be adjusted according to the error between paragraphs later.

[0242] Assume that in the above agricultural policy example, the text implicit representation set contains three text implicit representations, namely and , which correspond to the construction guides of the first, second and third paragraphs of the government response text. When the first paragraph of text information is determined as the target paragraph of text information in step S340, the computer system extracts As the target text is implicitly represented.

[0243] In order to achieve this extraction operation, the computer system can establish a mapping relationship or a marking mechanism when constructing a set of implicit text representations to associate each implicit text representation with the corresponding text paragraph. In this way, after the target segment text information is determined, the target text implicit representation can be quickly and accurately extracted based on this mapping relationship. This mapping relationship can be achieved through a key-value pair in a data structure (such as in a dictionary structure, the identifier of the text paragraph is the key and the corresponding implicit text representation is the value) or an index correspondence relationship (such as in an array structure, the implicit text representation is matched with the text paragraph in order).

[0244] Step S360: Adaptively update the implicit representation of the target text based on the inter-paragraph error value array that is currently downstream, and obtain the implicit representation of the target text after adaptive update.

[0245] As an implementation manner, step S360, adaptively updating the implicit representation of the target text based on the inter-paragraph error value array reached by the downstream, and obtaining the adaptively updated implicit representation of the target text, may include:

[0246] Step S361: adjusting the size of the implicit representation of the target text according to the size of the error value array between the paragraphs that are currently downstream, to obtain the implicit representation of the transition text;

[0247] Step S362: Adopting the cross-attention component, adaptively updating the implicit representation of the transition text in combination with the error value array between the paragraphs that are currently downstream, and obtaining the implicit representation of the transition text after adaptive update;

[0248] Step S363: According to the initial size of the implicit representation of the target text, the size of the implicit representation of the transition text after adaptive update is adjusted to obtain the implicit representation of the target text after adaptive update; wherein the initial size is the size of the implicit representation of the target text before the size of the implicit representation of the target text is adjusted.

[0249] In step S360, the computer system adaptively updates the implicit representation of the target text based on the inter-paragraph error value array that is currently downstream, thereby obtaining the implicit representation of the target text after adaptive update. This step is a key part of the entire operation process. By integrating the error conditions between text information reflected by the inter-paragraph error value array into the implicit representation of the target text, the implicit representation of the text can be adjusted to guide the generation of more satisfactory government response text paragraphs in the subsequent text information construction process, thereby improving the coherence and accuracy of the government response text.

[0250] In step S361, the computer system adjusts the size of the implicit representation of the target text by the size of the inter-paragraph error value array that is currently downstream, thereby obtaining the implicit representation of the transition text. The size adjustment here is an operation of adjusting the dimension or scale of the implicit representation of the target text according to the characteristics of the inter-paragraph error value array, with the purpose of making the implicit representation of the target text match the inter-paragraph error value array to some extent, so as to prepare for the subsequent update operation.

[0251] For example, suppose the target text implicitly represents is a vector of dimension n (e.g. n=5, =[0.1,0.2, 0.3, 0.4, 0.5]), when the downstream inter-paragraph error value array is an array containing m elements (for example, m=3, the inter-paragraph error value array is [0.05, 0.1, 0.15]). The computer system can adjust according to the relationship between m and n A simple way to adjust is to adjust it in proportion. If the dimension of the adjusted vector is n', the formula can be used (This is just a simple example formula, the actual situation may be more complicated). According to this formula, , then the implicit representation of transitional text may be achieved by somehow converting Convert to a vector with a dimension of 3. For example, take the first 3 elements of the original vector, and the implicit representation of the transition text is [0.1, 0.2, 0.3].

[0252] There are many technical means to adjust the size of the implicit representation of the target text. One method is based on vector projection or truncation operations. If you want to reduce the dimension of the implicit representation of the target text, you can use a projection operation to map it to a low-dimensional space, and the dimension of this low-dimensional space is determined by the size of the array of inter-paragraph error values. For example, you can use the idea of ​​principal component analysis (PCA) to find the main components in the implicit representation vector space of the target text, and then select the corresponding number of main components according to the size of the inter-paragraph error value array to construct the implicit representation of the transition text. If you want to increase the dimension of the implicit representation of the target text, you can use interpolation or expansion methods, such as inserting new elements between vector elements or copying elements according to certain rules to achieve the purpose of increasing the dimension.

[0253] In step S362, the computer system adopts the cross-attention component to adaptively update the implicit representation of the transition text in combination with the inter-paragraph error value array that is currently downstream, thereby obtaining the adaptively updated implicit representation of the transition text. The cross-attention component is a commonly used technical means in processing multi-source information fusion, which can effectively integrate the information in the inter-paragraph error value array into the implicit representation of the transition text, determine the importance of different parts of information by calculating the attention weight, and then adjust the implicit representation of the transition text.

[0254] Assume that the transition text is implicitly represented as , the inter-paragraph error value array is [0.05, 0.1, 0.15]. The cross-attention component first calculates the degree of association or attention weight between each element. For example, the attention weight is calculated through a simple dot product operation and a softmax function. Let the element in the implicit representation of the transition text be , the elements in the inter-paragraph error value array are , calculate the attention weight The formula can be: ; Where m is the number of elements in the inter-paragraph error value array (here m=3). Assume that the calculated attention weight matrix is: ; Then, the implicit representation of the transition text is updated according to the attention weight. Updated implicit representation of the transition text The elements of can be calculated by the following formula: Similarly, we can calculate , and obtain the adaptively updated implicit representation of the transition text. In practical applications, the cross-attention component can be implemented based on deep learning frameworks such as TensorFlow or PyTorch. These frameworks provide efficient matrix operations and function libraries that can easily implement the calculation of attention weights and weight-based information fusion operations. For example, in PyTorch, the `torch.nn.functional.softmax` function can be used to implement the softmax operation, and the application of attention weights and the update of the implicit representation of the transition text are implemented through custom matrix multiplication and summation operations.

[0255] In step S363, the computer system adjusts the size of the implicit representation of the adaptively updated transition text according to the initial size of the implicit representation of the target text, thereby obtaining the implicit representation of the adaptively updated target text. This step is to restore the implicit representation of the adaptively updated transition text to a size that matches the original implicit representation of the target text, so as to correctly guide the generation of the government affairs response text paragraph in the subsequent text information construction process.

[0256] Assume that the transition text after adaptive update is implicitly represented as , the initial size of the implicit representation of the target text is dimension 5 (as in the previous example The computer system needs to The dimension of is adjusted from 3 to 5. One possible adjustment method is to use interpolation. Assuming linear interpolation is used, new elements are inserted according to the distribution law of elements implicitly represented by the original target text. For example, elements can be inserted between adjacent elements in a certain proportion, and the implicit representation of the adaptively updated target text is obtained as [0.1, 0.11, 0.12, 0.13, 0.15].

[0257] The technical means of adjusting the size can be selected according to specific needs and data characteristics. In addition to interpolation methods, padding or compression methods can also be used. If padding is used, a default value (such as 0) can be inserted at the beginning, end, or middle of the vector to reach the target size based on the difference between the target size and the current size. If compression is used, the implicit representation of the transition text can be compressed to the target size according to certain rules (such as averaging and merging elements). These operations can be implemented by writing custom algorithms or using existing math library functions.

[0258] In summary, steps S340-S360 can effectively optimize the text implicit representation set by determining the target segment text information, extracting the target text implicit representation, and performing a series of adaptive update operations on the target text implicit representation based on the inter-paragraph error value array. This helps to improve the quality of government response text in the process of generating government data questions and answers based on the trusted large model, so that the generated government response text is more in line with the requirements of government questions and answers in terms of coherence and accuracy.

[0259] As an implementation mode, in step S300, multiple text information constructions are performed based on the text implicit representation set and the government trustworthy big model, which may include:

[0260] Step S301: obtaining a government affairs question text, which is used to define the answer content of the text information in the government affairs answer text;

[0261] Step S302: Generate a set of implicit question representations according to the government question text, where the set of implicit question representations includes X implicit question representations, and each implicit question representation is used to represent the government question text;

[0262] Step S303: Perform multiple text information constructions based on the question implicit representation set, the text implicit representation set and the government trustworthy big model; wherein any one text information construction is performed through the government trustworthy big model based on the question implicit representation set and the currently loaded text implicit representation set.

[0263] The computer system obtains the government affairs question text in step S301. The government affairs question text plays a key role in the entire government affairs data question and answer generation process. It is the basis for limiting the text information answer content in the government affairs answer text. The government affairs question text contains the user's description of government affairs related issues. These issues cover all aspects of the government affairs field, such as policy interpretation, government affairs service process consultation, government affairs event query, etc.

[0264] Suppose in a city government administration system, a user may ask a government question like this: "Please explain the specific requirements of the city's new environmental protection policy on energy conservation and emission reduction for enterprises and the support measures for small enterprises." This question clearly points out that the content to be answered is about the city's new environmental protection policy, and focuses on the specific requirements of energy conservation and emission reduction for enterprises and the support measures for small enterprises. After the computer system obtains this question text, it knows that it needs to build around these contents when generating the government response text in the future.

[0265] There are many ways for a computer system to obtain the text of government affairs questions. In modern government affairs information systems, there is usually a user interaction interface where users enter the question text, and then the computer system receives the text through a network communication protocol (such as the HTTP protocol). In addition, in some automated government affairs question-and-answer scenarios, government affairs question text may come from input from other systems or devices, such as text information converted from an intelligent voice device. The computer system needs to perform format verification and encoding conversion (if necessary) on the received question text to ensure that it can be correctly identified and processed by subsequent processing procedures. For example, if the question text is transmitted from a different character encoding environment, it may need to be converted to a unified UTF-8 encoding format.

[0266] In step S302, the computer system generates a set of implicit question representations based on the government question text. This set of implicit question representations contains X implicit question representations, each of which is used to represent the government question text. The implicit question representation is an abstract, mathematical representation of the government question text, which can convert the semantic information in the government question text into a form that is easy for the computer system to process and analyze. It is similar to the operation of embedding the government knowledge text to obtain the set of implicit text representations in step S200, but here it is an operation performed on the question text.

[0267] Continuing with the above-mentioned government question text about environmental protection policy as an example, "Please explain the specific requirements of the city's newly issued environmental protection policy on energy conservation and emission reduction for enterprises and support measures for small enterprises." The computer system converts this text into an implicit representation of the question. Assuming that a word vector model (a model that maps words to a low-dimensional vector space) is used to construct the implicit representation of the question, each word in the question text, such as "environmental protection policy", "enterprise", "energy conservation and emission reduction", "small enterprise", "support measures", etc., has a corresponding word vector. The computer system can combine these word vectors into a vector that can represent the entire question text through some combination method (such as weighted average or neural network-based method), which is an implicit representation of the question. Since it is assumed that the government response text contains X text paragraphs, X such implicit representations of the question will be generated, which together constitute a set of implicit representations of the question.

[0268] There are many technical means to generate a set of implicit representations of questions. In addition to the word vector model mentioned above, you can also use pre-trained language models in deep learning, such as BERT (Bidirectional Encoder Representations from Transformers). BERT can perform in-depth semantic analysis on the entire question text and output a vector representation of a fixed dimension. The computer system can copy or adjust the vector output by BERT according to the number of paragraphs X in the government response text to obtain X implicit representations of questions. In addition, a rule-based method can also be used to convert the question text into a structured representation based on the specific vocabulary and grammar rules in the government field, and then convert this structured representation into a vector-based implicit representation of the question.

[0269] In step S303, the computer system performs multiple text information constructions based on the implicit representation set of questions, the implicit representation set of texts, and the trusted big model of government affairs. Each text information construction here is performed by the trusted big model of government affairs based on the implicit representation set of questions and the currently loaded implicit representation set of texts. The trusted big model of government affairs is a model that is considered to be reliable in government affairs data processing. It can generate text information related to government affairs questions and answers based on the input implicit representation of questions and implicit representation of texts.

[0270] Assume that there is already a set of implicit representations of questions in the above example (including X implicit representations of questions) and a set of implicit representations of texts obtained in step S200 (also including X implicit representations of texts). When the text information is constructed for the first time, the government trustworthy big model takes the first implicit representation of questions and the first implicit representation of texts as input. For example, the implicit representation of questions may contain semantic information about the energy conservation and emission reduction requirements of enterprises in environmental protection policies, and the implicit representation of texts contains relevant information about environmental protection policies in government knowledge texts. Based on these inputs, the government trustworthy big model uses its internal neural network structure (assuming that the model is constructed based on neural networks) and pre-trained parameters to generate the first paragraph of text information. This first paragraph of text information may contain a preliminary answer to the specific requirements of the enterprise for energy conservation and emission reduction, such as mentioning the specific indicators that the enterprise needs to reduce energy consumption, the types and limits of pollutant emissions, etc. Then, when the text information is constructed for the second time, the government trustworthy big model will use the second implicit representation of questions and the second implicit representation of texts (or the implicit representation of texts after adaptive updating, depending on other operations in step S300) as input to generate the second paragraph of text information. This second paragraph of text information may be a response to the support measures for small enterprises, such as providing financial subsidies, technical support, etc. In this way, the government trustworthy big model will construct text information multiple times, and each construction will generate a paragraph of text information corresponding to the paragraph in the government response text.

[0271] The construction of the government trustworthy big model can be based on a variety of deep learning architectures, such as the Transformer architecture. When constructing text information, the multi-head attention mechanism in the model can effectively capture the semantic relationship between the implicit representation of the question and the implicit representation of the text. For the input implicit representation of the question and the implicit representation of the text, the model will process them through multiple layers of neural network layers. In each layer, the semantic information is gradually extracted and converted through linear transformation, activation function (such as ReLU function) and normalization operation (such as Layer Normalization).

[0272] When training a large government trustworthy model, a large amount of government question and answer data can be used for pre-training. For example, a large amount of government question texts and corresponding correct government answer texts can be collected, and these data can be organized in a certain format. Then, an optimization algorithm (such as the Adam optimization algorithm) can be used to adjust the parameters of the model so that the model can generate text information similar to the correct government answer text as accurately as possible given the implicit representation of the question and the implicit representation of the text.

[0273] In summary, steps S301-S303 play a core role in the embodiment of the present application by acquiring the government question text, generating a set of implicit representations of the question, and using the government trustworthy big model to perform multiple text information constructions. These steps lay the foundation for further optimizing the generation of government response texts (such as adaptively updating the set of implicit representations of the text by acquiring the set of errors between paragraphs, etc.), ensuring that the government response text can accurately answer the questions in the government question text and has good semantic coherence and accuracy.

[0274] An embodiment of the present application provides a computer system, including a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.

[0275] Figure 2 A hardware entity diagram of a computer system provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the hardware entity of the computer system 1000 includes: a processor 1001 and a memory 1002, wherein the memory 1002 stores a computer program that can be run on the processor 1001, and the processor 1001 implements the steps in the method of any of the above embodiments when executing the program.

[0276] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for generating government data questions and answers based on a trustworthy large model, characterized by: include: Obtaining a government affairs knowledge text, where the government affairs knowledge text is used to guide text information in a government affairs response text to be generated, where the government affairs response text includes X text paragraphs, where X ≥ 2; A text implicit representation set is obtained based on the embedding of the government affairs knowledge text, wherein the text implicit representation set includes X text implicit representations, each of which is used to represent the government affairs knowledge text; the xth text implicit representation in the text implicit representation set is used to guide the construction of the xth text paragraph in the government affairs response text, where x is a positive integer not greater than X; Multiple text information constructions are performed based on the text implicit representation set and the government trustworthy big model, each time the text information construction is performed to obtain X segments of text information, where the xth segment of text information corresponds to the xth text paragraph; wherein, when performing the multiple text information constructions, each time the text information construction is completed to obtain X segments of text information, an inter-paragraph error set corresponding to the current X segments of text information is obtained, and one or more text implicit representations in the text implicit representation set are adaptively updated based on the inter-paragraph error set, and the adaptively updated text implicit representation set is simultaneously loaded into the government trustworthy big model for a subsequent text information construction; the inter-paragraph error set is used to represent the error between any two preceding and following segments of text information in the corresponding X segments of text information; Generate the government affairs response text based on the X segments of text information obtained from the last text information construction in the multiple text information constructions; Each segment of text information includes text representations of multiple text elements. The step of obtaining the set of inter-paragraph errors corresponding to the current X segments of text information includes: Performing text processing on the current X segments of text information, wherein the text processing includes: cleaning repeated semantic information of the same text element in the X segments of text information, or filtering the text representation of each text element in each segment of text information; After the text processing, determining the difference between the preceding and following text information in the current X text information segments one by one to obtain an array of Y inter-paragraph error values, where Y=X-1; wherein the determining the difference includes: determining the error between two text representations of the same text element in the preceding and following text information segments; Based on the Y inter-paragraph error value arrays, an inter-paragraph error set corresponding to the currently generated X paragraphs of text information is generated.

2. The method according to claim 1, characterized in that Before performing the text processing, the text representation of any text element in each piece of text information represents text semantic information of the corresponding text element; If the text processing includes cleaning up identical text semantic information of identical text elements in X segments of text information, then performing text processing on the current X segments of text information includes: Wandering the multiple text elements, determining the currently wandered text element as the a-th text element, where a is a positive integer not greater than S, and S is the number of text elements; Obtaining a text representation adjustment variable of the a-th text element, where the text representation adjustment variable is obtained by summarizing and analyzing X text representations of the a-th text element in the current X segments of text information; According to the text representation adjustment variable, the X text representations of the a-th text element in the current X segments of text information are adjusted; wherein the adjustment is to perform vector value correction according to a set adjustment method.

3. The method according to claim 2, characterized in that The inductive analysis includes determining an average value, and obtaining the text representation adjustment variable of the a-th text element includes: Obtaining a first filter, where the first filter includes X-dimensional first filter matrices, each of which is a scalar matrix, and the X-dimensional first filter matrices are used to perform average filtering on X text representations of the same text element in the current X segments of text information; Performing average filtering on the current X segments of text information using the first filter to obtain a first text filter representation; wherein the first text filter representation includes S first filtering results, and the a-th first filtering result represents an average result of the X text representations of the a-th text element in the current X segments of text information; In the first text filtering representation, obtaining the ath first filtering result as a text representation adjustment variable of the ath text element; The text representation adjustment variable includes an average result of X text representations of the a-th text element in the current X segments of text information; and adjusting the X text representations of the a-th text element in the current X segments of text information according to the text representation adjustment variable includes: The average result of the X text representations of the a-th text element in the current X segments of text information is used as the average text representation corresponding to the a-th text element; Wander through the X text representations of the a-th text element in the current X segments of text information, and use the currently wandered text representation as the x-th text representation; determining an error between the xth text representation and an average text representation corresponding to the ath text element to obtain a first error result; adjusting the xth text representation based on a ratio between the first error result and an average text representation corresponding to the ath text element; Alternatively, the text representation adjustment variable includes a maximum text representation and a minimum text representation among the X text representations of the a-th text element in the current X segments of text information; and adjusting the X text representations of the a-th text element in the current X segments of text information according to the text representation adjustment variable includes: Determine an error between a maximum text representation and a minimum text representation among the X text representations of the a-th text element in the current X segments of text information to obtain a second error result; For an x-th text representation among the X text representations, an error between the x-th text representation and the minimum text representation is determined, and the x-th text representation is adjusted based on a ratio between the determined error and the second error result.

4. The method according to claim 2, characterized in that When the plurality of text elements have completed wandering, the text processing of the current X segments of text information further includes: Obtain a second filter, where the second filter includes a second filter matrix of x dimensions, where the size of each second filter matrix is ​​n×1, and n≥2; and the second filter matrix of the xth dimension is used to perform average filtering on the xth segment of text information; Using the second filter to perform average filtering on the current X segments of text information to obtain X second text filter representations; Each second text filter representation includes T second filter results, T ≥ 1, the t-th second filter result in the x-th second text filter representation represents an average result of each text representation in the t-th range of size n×1 in the x-th segment of text information, and t is not greater than T; Adjusting the t-th second filtering result in the X second text filtering representations to obtain X adjusted second filtering results; In the xth piece of text information included in the current X pieces of text information, each text representation in the tth range of size n×1 is adjusted to the xth adjusted second filtering result.

5. The method according to claim 1, wherein If the text processing includes filtering the text representation of each text element in each segment of text information, then the text processing of the current X segments of text information includes: Obtain a third filter, where the third filter includes a third filter matrix of one dimension, and the size of the third filter matrix is ​​k×1, where k≥2; Access the current X segments of text information in sequence to determine the currently accessed segment x; Using the third filter to perform average filtering on the x-th segment of text information, obtaining E third filtering results, where E ≥ 1, the e-th third filtering result represents an average result of each text representation in the e-th range of size k×1 in the x-th segment of text information, and e is not greater than E; In the x-th segment of text information, adjusting each text representation in the e-th range of size k×1 into the e-th third filtering result; Generating an inter-paragraph error set corresponding to the currently generated X paragraphs of text information based on the Y inter-paragraph error value arrays includes: Creating an inter-paragraph error value array with all zero elements, adding the created inter-paragraph error value array to the front of the Y inter-paragraph error value arrays to obtain X inter-paragraph error value arrays arranged in sequence; Summarizing and analyzing the X element values ​​of the same text element in the X inter-paragraph error value arrays to obtain an element value adjustment variable for each text element; Based on the element value adjustment variable of each text element, the X element values ​​of the corresponding text element in the X inter-paragraph error value arrays are adjusted to obtain an inter-paragraph error set corresponding to the X paragraphs of text information currently generated; wherein the adjustment is to perform vector value correction according to a set adjustment method.

6. The method according to claim 1, wherein The inter-paragraph error set includes one or more inter-paragraph error value arrays, one inter-paragraph error value array corresponds to a segment of text information, and any inter-paragraph error value array represents the error between the corresponding segment of text information and an adjacent segment of text information; Adaptively updating one or more text implicit representations in the text implicit representation set according to the inter-paragraph error set includes: Walking through each inter-paragraph error value array in the inter-paragraph error set, and determining a segment of text information corresponding to the inter-paragraph error value array currently walked to as the target segment of text information; Extracting, from the text implicit representation set, a text implicit representation used to construct the target segment text information as the target text implicit representation; The implicit representation of the target text is adaptively updated based on the inter-paragraph error value array that is currently reached, to obtain the adaptively updated implicit representation of the target text.

7. The method according to claim 6, characterized in that Adaptively updating the implicit representation of the target text based on the inter-paragraph error value array reached downstream to obtain the adaptively updated implicit representation of the target text includes: Adjusting the size of the implicit representation of the target text according to the size of the inter-paragraph error value array that is currently reached, to obtain the implicit representation of the transition text; Adopting a cross-attention component, adaptively updating the implicit representation of the transition text in combination with the inter-paragraph error value array of the current downstream, to obtain an adaptively updated implicit representation of the transition text; According to the initial size of the implicit representation of the target text, the size of the implicit representation of the transition text after the adaptive update is adjusted to obtain the implicit representation of the target text after the adaptive update; wherein the initial size is the size of the implicit representation of the target text before the size of the implicit representation of the target text is adjusted.

8. The method according to claim 1, characterized in that The multiple text information constructions based on the text implicit representation set and the government trustworthy big model include: Obtaining a government affairs question text, wherein the government affairs question text is used to define the answer content of the text information in the government affairs response text; Generating a set of implicit question representations based on the government question text, wherein the set of implicit question representations includes X implicit question representations, each of which is used to represent the government question text; Multiple text information constructions are performed based on the question implicit representation set, the text implicit representation set and the government trustworthy big model; wherein any text information construction is performed by the government trustworthy big model based on the question implicit representation set and the currently loaded text implicit representation set.

9. A computer system comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 8 are implemented.