Policy text analysis method
Through the combination of a large language model and a knowledge base, an automated policy text analysis system is built, which solves the problem of low efficiency of traditional manual analysis, and realizes efficient and accurate policy text analysis, supporting policy evaluation and decision-making.
Patent Information
- Application Number
- CN202411036343.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-15
AI Technical Summary
Traditional artificial analysis of policy texts lack systematicity and objectivity, low efficiency, and difficult to cope with exponential growth policy documents and complex content.
The large language model is used to combine the knowledge base to construct it, and the prompt word sample library, standard label knowledge library and non-standard label knowledge base are used to achieve automatic analysis of policy texts, and model training and optimization are used to use Few Shot learning and role system.
It improves the analytical efficiency and accuracy of policy texts, supports policy impact simulation and evaluation, and ensures the continuous evolution and optimization of the model.
Smart Images

Figure CN118966192A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a policy text parsing method. Background Art
[0002] Policy documents are usually full of professional terms, which increases the difficulty of policy text analysis. Traditional manual policy text analysis relies on subjective experience and judgment, lacks systematicity and objectivity, and is inefficient. With the exponential increase in the number of policy documents and the increasing complexity of policy content, there is an urgent need for an automated, efficient, and accurate policy analysis tool to support the work of policy makers, business managers, and researchers. Summary of the invention
[0003] The present invention aims to realize automatic and accurate analysis of policy texts and provides a policy text analysis method.
[0004] To achieve this object, the present invention adopts the following technical solutions:
[0005] A policy text parsing method is provided, the steps comprising:
[0006] S1, constructing a knowledge base, wherein the knowledge base includes any one or more of a prompt word sample base of a policy text, a standard label knowledge base, and a non-standard label knowledge base;
[0007] S2, using the knowledge base, obtaining training samples to iteratively complete the training of the large language model;
[0008] S3, the large language model parses the input policy text and outputs the parsing result.
[0009] Preferably, the prompt word sample library includes a first mapping relationship between policy content and standard labels.
[0010] Preferably, the construction of the non-standard tag knowledge base comprises the steps of:
[0011] A1, crawl the policy database;
[0012] A2, write and optimize basic prompt words;
[0013] A3, generate non-standard label text to form a non-standard label library;
[0014] A4, for each non-standard tag in the non-standard tag library, construct a second mapping relationship between the non-standard tag and the standard tag;
[0015] A5, vectorize each of the non-standard tags in the library to form the non-standard tag knowledge base carrying the second mapping relationship.
[0016] Preferably, in step A2, the method for compiling and optimizing the basic prompt words corresponding to each standard tag comprises the steps of:
[0017] A21. Clarify which standard labels need to be extracted from the policy text, such as applicable regions, industry categories, etc.
[0018] A22, based on the needs analysis, write preliminary prompt words. For example, if you want to extract the applicable regions, you can write prompt words: "Please identify which regions this policy applies to?".
[0019] A23 uses the preliminarily written prompt words to call the large language model to evaluate whether the model can correctly identify the standard labels.
[0020] A24, based on the test results, gradually adjust and optimize the prompt words until a satisfactory recognition effect is achieved.
[0021] A25, after several rounds of testing, we invited policy interpretation experts to review the prompt words to ensure their professionalism and accuracy.
[0022] A26, after expert review, determines the final basic prompt words and uses them for subsequent large language model training and testing.
[0023] Preferably, in step A3, the method for generating the non-standard label text comprises the steps of:
[0024] A31, selects representative policy texts from the crawled policy library.
[0025] A32, based on the previously written and optimized basic prompt words, prepare prompt words corresponding to the policy text.
[0026] A33, calls the large language model in batches, taking the policy text and the corresponding prompt words as input.
[0027] A34, collects the outputs generated by the model, which are non-standard labels.
[0028] A35, manually review the generated non-standard labels, remove erroneous or irrelevant labels, and retain valid non-standard labels.
[0029] A36, sort the cleaned non-standard labels into storage.
[0030] Preferably, in step S2, the method for obtaining the training sample comprises the steps of:
[0031] B1, perform word segmentation on the input policy text;
[0032] B2, extracting keywords from the policy text;
[0033] B3, identify key sentences in the policy text;
[0034] B4, using the extracted or identified keywords and / or key sentences as similarity matching basis, extracting a number of samples with similarities greater than a similarity threshold from the prompt word sample library as the training samples for training the large language model.
[0035] Preferably, step B1 comprises the steps of:
[0036] B11, remove stop words from the policy text;
[0037] B12, using the Lemmatizer morphological restorer to perform stem extraction and lemmatization on the policy text after removing stop words;
[0038] B13, using the HanLP text analysis tool to segment the policy text after lemma restoration.
[0039] Preferably, step B2 is specifically as follows:
[0040] Calculate the TF-IDF value of each word in the policy text in step B1, and use each word above the TF-IDF threshold as a keyword of the policy text;
[0041] Using the LDA algorithm, a word frequency matrix is constructed for each word segment obtained in step B1 for the policy text, and then the number of topics is set and the word frequency matrix is trained to identify several topics hidden in the policy text, each topic is represented by a set of high-probability words;
[0042] In step B3, the TextRank algorithm is used to identify key sentences in the policy text.
[0043] Preferably, in step S2, the method for training the large language model is:
[0044] Use Few Shot to learn and combine the role system to build a comprehensive prompt word for a large language model. The construction process is as follows:
[0045] Define roles and scenarios, including the environment setter System, the questioner User, and the user request response AI;
[0046] Constructing a Few Shot example, constructing the training sample matched from the prompt word sample library and the corresponding standard label into a Few Shot example;
[0047] The defined roles, scenarios, and Few Shot examples are constructed as comprehensive prompts of the large language model to guide the model to understand the functions of different roles and generate responses based on the input; the System role in the comprehensive prompt sets the role and describes the requirements, User represents the input, and AI represents the return result of the large language model;
[0048] The non-standard tags in the returned results are standardized, and the processing method includes the following steps:
[0049] C1, convert non-standard labels into vector values;
[0050] C2, compares non-standard labels and standard labels using cosine similarity;
[0051] If there is a standard tag with a similarity greater than or equal to 0.95, the standard tag with successful similarity matching is returned;
[0052] If not, go to step C3;
[0053] C3, compares non-standard labels and non-standard label knowledge base using cosine similarity;
[0054] If there are non-standard tags with a similarity greater than or equal to 0.95, the corresponding non-standard tags in the non-standard tag knowledge base are returned;
[0055] If there are non-standard labels with a similarity greater than or equal to 0.8, the non-standard labels, standard labels, and policy text data with a similarity greater than or equal to 0.8 are submitted as cases to the large language model as training samples for iterative model updates;
[0056] If the similarity is greater than or equal to 0.8 and does not exist, the result of non-standard label normalization failure is returned.
[0057] The present invention realizes the automated and intelligent analysis of policy texts by constructing a policy indicator analysis system based on a large language model, supports policy impact simulation and evaluation, and ensures the continuous evolution and optimization of the model through evaluation feedback, greatly improving the analysis efficiency and accuracy of policy texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0059] Figure 1 It is a diagram of implementation steps of a policy text parsing method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The technical solution of the present invention is further described below with reference to the accompanying drawings and through specific implementation methods.
[0061] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on this patent; in order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0062] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "inner", "outer", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as a limitation on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0063] In the description of the present invention, unless otherwise clearly specified and limited, if the term "connection" or the like appears to indicate the connection relationship between components, the term should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two components or the interaction relationship between two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0064] In recent years, the release and dissemination of policy documents have become more rapid and extensive. The demand for text parsing and evaluation of policy documents is becoming increasingly urgent. Traditional rule-based text analysis methods have obvious limitations when processing policy documents, especially when faced with the diversity, complexity and professionalism of policy texts. Natural language processing technology, especially the development of large language models, provides new solutions for the automatic parsing of policy documents. Through pre-training on massive text data, the model learns deep language representation and rich knowledge, and demonstrates excellent capabilities in text understanding, semantic reasoning, entity recognition, etc. The advantage of the large prediction model is that it has strong context-awareness and can capture deep semantic information of words, phrases and even entire sentences, thus showing unprecedented potential in policy text parsing tasks. In addition, the large language model also has good generalization ability and can adapt to different application scenarios and task requirements.
[0065] In recent years, the research and application of large language models have made significant progress. By fine-tuning on specific tasks, the model can better adapt to the specific needs of policy document parsing, improve the accuracy and efficiency of the model, and enable the model to quickly adapt to new tasks even with less labeled data. The development of large language models provides strong technical support for the automatic parsing of policy documents. Based on the above technical background, the present invention proposes a new policy text parsing method, which utilizes the deep reading comprehension ability of a large language model, combined with the characteristics and parsing requirements of policy documents, to achieve automated and precise parsing of policy documents, providing favorable technical support for policy evaluation and decision-making.
[0066] The policy text parsing method provided by the embodiment of the present invention includes the following two steps:
[0067] Step 1: Knowledge base construction
[0068] 1. Construction of prompt word sample library
[0069] At present, large language models have the problem of unstable output. In order to reduce the impact of this factor on the accuracy of text parsing results, some cases need to be provided for large language models to learn. The prompt word sample library stores several policy cases, each of which contains the corresponding relationship between the content of each policy document and the standard label.
[0070] The construction of the prompt word sample library requires the participation of experienced policy interpretation experts to professionally interpret the policy text in order to establish a data mapping relationship between the policy text and the standard label. Based on different extraction labels, the policy interpretation experts continuously optimize and update the mapping relationship data between the policy text paragraphs and the standard labels.
[0071] 2. Standard label knowledge base
[0072] The standard labeling system used in the present invention mainly includes: applicable regions (national provincial, municipal, county and district data), various industry-oriented standard labeling systems, such as the national standard GB / T 4754-2017 for classifying national economic industries).
[0073] Based on the data of standard labels, the embedding interface opened by the large language model or the model encoding method of SentenceTransformer is used to vectorize the standard labels, and the standard label text and the corresponding vector representation are stored in the vector database.
[0074] 3. Non-standard label knowledge base
[0075] The non-standard label knowledge base is constructed through the following steps:
[0076] 1) Crawling the policy database
[0077] From the government data open platform, for example, from the policy document release section of a provincial people's government, collect policy texts to form a policy database;
[0078] 2) Writing and optimizing basic prompt words
[0079] Write basic prompt words according to the standard labels that the large language model needs to extract. The method of writing basic prompt words is: first, clarify the definition and scope of each standard label. For example, for the standard label "applicable area", you need to know that it refers to the geographical area covered by the policy. Secondly, according to the definition of the standard label, design a series of guiding questions or instructions, which should be able to effectively guide the large language model to extract information related to the label. For example, "Please indicate the area to which the policy applies" or "List all administrative divisions mentioned." Then, through continuous testing and adjustment, optimize these prompt words to ensure that they can accurately guide the model to extract the correct information. The basic prompt words of different standard labels need to be continuously optimized through multiple interactions of the large language model to eventually form the basic prompt word text.
[0080] Specifically, first, it is necessary to clarify which standard labels need to be extracted from the policy text, such as applicable regions, industry categories, etc.
[0081] Then, based on the needs analysis, write preliminary prompt words. For example, if you want to extract the applicable regions, you can write prompt words: "Please identify which regions this policy applies to?".
[0082] Then, the large language model is called using the preliminarily written prompt words, and the model is evaluated to see whether it can correctly identify the standard labels;
[0083] Then use the preliminarily written prompt words to call the large language model and evaluate whether the model can correctly identify the standard label;
[0084] After multiple rounds of testing, policy interpretation experts were invited to review the prompt words to ensure their professionalism and accuracy;
[0085] Finally, after expert review, the final basic prompt words are determined and used for subsequent large language model training and testing.
[0086] 3) Generate non-standard label text
[0087] The policy texts of the policy library and the corresponding basic prompt word texts are batch-called into a large language model to form a non-standard tag library. The specific method is as follows:
[0088] First, carefully select representative policy texts from the crawled policy library. Next, prepare corresponding prompt words for each policy text based on the previously written and optimized basic prompt words. Then, call the large language model and input the policy text and its corresponding prompt words into the model.
[0089] The model generates a series of outputs based on the input information, which are the so-called non-standard labels. Then, the generated labels need to be manually reviewed to eliminate any inaccurate or irrelevant labels and ensure that only valid and relevant non-standard labels are retained.
[0090] The last step is to archive the cleaned and sorted valid non-standard labels into a library, thus building a complete non-standard label library.
[0091] 4) Mapping between non-standard tags and standard tags
[0092] For the non-standard label text formed by calling the large language model, manual data cleaning and standard label annotation are performed, so as to establish a mapping relationship between the non-standard labels identified by the large language model for the policy text and the standard labels manually annotated for the policy text. In the present invention, for the policy library crawled in step 1), more than 5,000 non-standard label texts were cleaned and a mapping relationship with the corresponding standard labels was established.
[0093] 5) Non-standard label vectorization
[0094] Similar to the process of building a standard label knowledge base, the embedding interface of the large language model or the model encoding method of SentenceTransformer is called to vectorize non-standard labels and finally form a knowledge base of non-standard labels.
[0095] Step 2: Model Execution and Adjustment
[0096] 1. Cleaning, noise reduction, keyword analysis, key sentence analysis
[0097] The purpose of this step is to parse the key information in the currently input policy document for similarity matching with the samples in the prompt sample library, and extract the sample cases with relatively high similarity to input to the large language model.
[0098] The processing methods include:
[0099] 1) Text preprocessing and noise reduction
[0100] The purpose of this step is to remove the stop words such as "de" (的) and "shi" (是) that do not carry specific meanings in the policy text, and then convert all the letters in the text to uppercase or lowercase to reduce the size of the vocabulary. Then, use the Lemmatizer morphological reducer for stemming and lemmatization to restore the vocabulary to its basic form and reduce the complexity brought by word form changes. Finally, use the HanLP text analysis tool for word segmentation to cut the text into words or phrases.
[0101] 2) Keyword extraction
[0102] In this embodiment, keyword extraction uses a combination of TF-IDF (Term Frequency-Inverse Document Frequency) and LDA (Latent Dirichlet Allocation).
[0103] TF-IDF: Term Frequency-Inverse Document Frequency, is a commonly used statistical method in information retrieval and text mining, used to evaluate the importance of a word in a document.
[0104] LDA: Latent Dirichlet Allocation, is a text topic analysis method based on probabilistic graphical models, aiming to automatically discover its hidden topic structure by analyzing text data.
[0105] In this embodiment, in the use of the TF-IDF algorithm, the word segmentation obtained in step B1 is used to calculate the value of each word using TF-IDF, and the words with high TF-IDF values are selected as keywords. These keywords not only reveal the core issues of the policy text but also can be used to compare the similarities and differences of different policies.
[0106] In the use of the LDA algorithm, the word segmentation obtained in step B1 is used to construct a clear word frequency matrix, and then the number of topics is set. The LDA algorithm is used to train the word frequency matrix to identify several topics hidden in the policy text, and each topic is represented by a group of high-probability vocabulary. The "high probability" in the high-probability vocabulary refers to those words that appear frequently in a certain topic and are closely related to that topic. The probability values of these words reflect their importance and representativeness in the topic.
[0107] 3) Key sentence analysis and identification
[0108] Key sentence analysis and identification uses the TextRank algorithm, which is an unsupervised algorithm based on PageRand and is used to extract key sentences from text.
[0109] The method of analyzing key sentences by the TextRandk algorithm is briefly described as follows:
[0110] First, the policy text is segmented through step B1 to ensure that the algorithm can accurately identify semantic units. Then, a word co-occurrence matrix or sentence similarity matrix is constructed, and a weighted undirected graph is formed by calculating the correlation between words or sentences. Then, the TextRank algorithm is used to iteratively calculate on the graph to obtain the importance score of each node (word or sentence). Finally, the scores are sorted and the sentences with higher scores are selected as key sentences.
[0111] After analyzing the keywords and key sentences, we get the key information in the policy text, which includes the core content, goals, measures and impact of the policy. Finally, we vectorize this key information and match it with the vector data in the prompt word sample library for similarity, and get the highest similarity as training samples for the large language model to learn.
[0112] 2. Training of large language models
[0113] In this embodiment, Few Shot learning is used in combination with the role system to build the prompt words of the large language model. A small number of examples are used to guide the model to understand and generate text that meets the specific context or role requirements. The construction process is divided into the following two steps:
[0114] 1) Define roles and scenarios
[0115] Clarify the responsibilities and expected behaviors of each role (System, User, AI) in a conversation or task.
[0116] System, usually the one who sets the environment, provides rules, background information or tasks.
[0117] User: A role that raises questions, needs, or challenges.
[0118] AI: A role that responds to user requests and provides solutions or information.
[0119] 2) Integrate the Few Shot example
[0120] Construct a few shot examples based on the policy samples and standard labels matched from the prompt word sample library.
[0121] The Few Shot example contains User and AI roles. The User role represents the policy information matched from the sample library, and the AI role represents the standard label returned by the large model, as shown in the following example: [
[0123] "User":"Small and medium-sized enterprises (including individual businesses unless otherwise specified) that are facing temporary liquidity difficulties but can quickly resume normal operations, and were registered and established before the end of 2021 and are still operating normally (or have begun to resume work and production).",
[0124] "AI":"Medium-sized enterprises, small enterprises, micro-enterprises, and individual businesses" ]
[0126] Finally, a comprehensive prompt word is constructed based on the roles and Few Shot examples to guide the model to understand the functions of different roles and generate appropriate responses based on the input. The comprehensive prompt word consists of a System role, multiple User roles, and multiple AI roles. The System role sets the environment and describes the requirements, the User represents the input, and the AI represents the result returned by the large language model. Finally, a User role represents the current input, as shown in the following example: [
[0128] "System":"You are a policy analysis robot. Please analyze the enterprise scale that the policy is suitable for from the given policy information",
[0129] "User":"Small and medium-sized enterprises (including individual businesses unless otherwise specified) that are facing temporary liquidity difficulties but can quickly resume normal operations, and were registered and established before the end of 2021 and are still operating normally (or have begun to resume work and production).",
[0130] "AI":"Medium-sized enterprises, small enterprises, micro-enterprises, and individual businesses",
[0131] "User":"From April 15, 2020, counter-guarantee requirements will be waived for newly issued personal entrepreneurship guarantee loans of RMB 100,000 or less, as well as entrepreneurial projects recommended by national entrepreneurship incubation demonstration bases or credit communities (villages), entrepreneurs, entrepreneurial projects, and entrepreneurial enterprises that have won honorary titles at the municipal level or above, credit-worthy small and micro enterprises, merchants, and farmers assessed and recognized by financial institutions, and second-time entrepreneurs with stable operations and good faith, and other specific groups." ]
[0133] 3. Standardization of non-standard labels
[0134] The results returned by the large language model each time may not be the standard labels required by the system. A standardization process for non-standard labels is required. This process can be divided into the following steps:
[0135] 1) Convert non-standard labels to vector values;
[0136] 2) Compare non-standard labels with standard labels using cosine similarity;
[0137] 3) If there is a standard tag with a similarity greater than or equal to 0.95, return the standard tag with successful similarity matching; if not, use cosine similarity to compare the non-standard tag and the non-standard tag knowledge base.
[0138] 4) If there are non-standard labels with a similarity greater than or equal to 0.95, the corresponding non-standard labels in the non-standard label knowledge base are returned; if there are non-standard labels with a similarity greater than or equal to 0.8, the non-standard labels, standard labels, and policy text data greater than or equal to 0.8 are submitted as cases to the large language model as training samples for iterative model updates; if there are no non-standard labels with a similarity greater than or equal to 0.8, the result of non-standard label standardization failure is returned.
[0139] In summary, the present invention realizes the automated and intelligent analysis of policy texts by constructing a policy indicator analysis system based on a large language model, supports policy impact simulation and evaluation, and ensures the continuous evolution and optimization of the model through evaluation feedback, thereby greatly improving the analysis efficiency and accuracy of policy texts.
[0140] It should be noted that the above specific implementations are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art should understand that various modifications, equivalent substitutions, changes, etc. can be made to the present invention. However, as long as these changes do not deviate from the spirit of the present invention, they should be within the scope of protection of the present invention. In addition, some terms used in the specification and claims of this application are not restrictive, but are only for the convenience of description.
Claims
1. A policy text parsing method, characterized in that the steps include: S1, constructing a knowledge base, wherein the knowledge base includes any one or more of a prompt word sample base of a policy text, a standard label knowledge base, and a non-standard label knowledge base; S2, using the knowledge base, obtaining training samples to iteratively complete the training of the large language model; S3, the large language model parses the input policy text and outputs the parsing result.
2. A policy text parsing method according to claim 1, characterized in that: The prompt word sample library includes a first mapping relationship between policy content and standard labels.
3. A policy text parsing method according to claim 1, characterized in that: The construction of the non-standard tag knowledge base includes the following steps: A1, crawl the policy database; A2, write and optimize basic prompt words; A3, generate non-standard label text to form a non-standard label library; A4, for each non-standard tag in the non-standard tag library, construct a second mapping relationship between the non-standard tag and the standard tag; A5, vectorize each of the non-standard tags in the library to form the non-standard tag knowledge base carrying the second mapping relationship.
4. A policy text parsing method according to claim 3, characterized in that: In step A2, the method for compiling and optimizing the basic prompt words corresponding to each standard tag comprises the following steps: A21,clearly requires standard labels to be extracted from policy texts; A22, based on demand analysis, write preliminary prompt words; A23, use the preliminarily written prompt words to call the large language model and evaluate whether the model can correctly identify the standard label; A24, based on the test results, gradually adjust and optimize the prompt words until a satisfactory recognition effect is achieved; A25, after multiple rounds of testing, invited policy interpretation experts to review the prompt words to ensure their professionalism and accuracy; A26, after expert review, determines the final basic prompt words and uses them for subsequent large language model training and testing.
5. A policy text parsing method according to claim 3, characterized in that: In step A3, the method for generating the non-standard label text comprises the steps of: A31, selects representative policy texts from the crawled policy library; A32, prepare prompt words corresponding to the policy text based on the previously written and optimized basic prompt words; A33, batch calls the large language model, taking the policy text and the corresponding prompt words as input; A34, collects the outputs generated by the model, which are non-standard labels; A35, manually review the generated non-standard labels, remove erroneous or irrelevant labels, and retain valid non-standard labels; A36, sort the cleaned non-standard labels into storage.
6. A policy text parsing method according to claim 1, characterized in that: In step S2, the method for obtaining the training sample comprises the steps of: B1, perform word segmentation on the input policy text; B2, extracting keywords from the policy text; B3, identify key sentences in the policy text; B4, using the extracted or identified keywords and / or key sentences as similarity matching basis, extracting a number of samples with similarities greater than a similarity threshold from the prompt word sample library as the training samples for training the large language model.
7. A policy text parsing method according to claim 6, characterized in that: Step B1 comprises the steps of: B11, remove stop words from the policy text; B12, using the Lemmatizer morphological restorer to perform stem extraction and lemmatization on the policy text after removing stop words; B13, using the HanLP text analysis tool to segment the policy text after lemma restoration.
8. A policy text parsing method according to claim 6 or 7, characterized in that: Step B2 is specifically as follows: Calculate the TF-IDF value of each word in the policy text in step B1, and use each word above the TF-IDF threshold as a keyword of the policy text; Using the LDA algorithm, a word frequency matrix is constructed for each word segment obtained in step B1 for the policy text, and then the number of topics is set and the word frequency matrix is trained to identify several topics hidden in the policy text, each topic is represented by a set of high-probability words; In step B3, the TextRank algorithm is used to identify key sentences in the policy text.
9. A policy text parsing method according to claim 1, characterized in that: In step S2, the method for training the large language model is: Use Few Shot to learn and combine the role system to build a comprehensive prompt word for a large language model. The construction process is as follows: Define roles and scenarios, including the environment setter System, the questioner User, and the user request response AI; Constructing a Few Shot example, constructing the training sample matched from the prompt word sample library and the corresponding standard label into a Few Shot example; The defined roles, scenarios, and Few Shot examples are constructed as comprehensive prompts of the large language model to guide the model to understand the functions of different roles and generate responses based on the input; the System role in the comprehensive prompt sets the role and describes the requirements, User represents the input, and AI represents the return result of the large language model; The non-standard tags in the returned results are standardized, and the processing method includes the following steps: C1, convert non-standard labels into vector values; C2, compares non-standard labels and standard labels using cosine similarity; If there is a standard tag with a similarity greater than or equal to 0.95, the standard tag with successful similarity matching is returned; If not, go to step C3; C3, compares non-standard labels and non-standard label knowledge base using cosine similarity; If there are non-standard tags with a similarity greater than or equal to 0.95, the corresponding non-standard tags in the non-standard tag knowledge base are returned; If there are non-standard labels with a similarity greater than or equal to 0.8, the non-standard labels, standard labels, and policy text data with a similarity greater than or equal to 0.8 are submitted as cases to the large language model as training samples for iterative model updates; If the similarity is greater than or equal to 0.8 and does not exist, the result of non-standard label normalization failure is returned.
Citation Information
Cited By
Multi-agent-based SQL statement end-to-end batch generation method
CN119179711A
Construction system of standard system model
CN119379039A
Policy text interpretation method and device
CN119740568A
