Big language model-based most stringent specification rule extraction method and system
Patent Information
- Application Number
- CN202510861970.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-06-25
AI Technical Summary
然而,当前的自动化复核系统在处理规范之间的差异时,缺乏一个明确的标准来确保遵循最严格的规范
[0037] This application provides a method and system for extracting the most stringent normative rules based on a large language model. This method can automatically identify differences between various normative clauses and select the most stringent rule for execution. Through clause information extraction, difference identification, and selection of the most stringent rule, this invention effectively avoids compliance issues caused by differences between norms, providing a more accurate and efficient solution for reviewing survey reports.
Smart Images

Figure CN120764642B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of engineering geology technology, specifically to a method and system for extracting the most stringent normative rules based on a large language model. Background Technology
[0002] In fields such as geological exploration and construction engineering, exploration reports often adhere to multiple industry standards. Due to potential differences and conflicts between these standards, the most stringent standard rule must be selected for implementation during report review. However, current automated review systems lack a clear standard to ensure compliance with the most stringent standard when handling discrepancies. Therefore, a method for extracting the most stringent standard rule based on a large language model has emerged, effectively identifying and selecting the most stringent standard clauses to avoid compliance issues caused by standard conflicts. Summary of the Invention
[0003] This application provides a method and system for extracting the most stringent normative rules based on a large language model. The method utilizes a large language model to extract normative clauses and identify differences, thereby ensuring that the most stringent rules are enforced across multiple norms.
[0004] According to the first aspect, one embodiment provides a method for extracting the most stringent canonical rules based on a large language model, the method comprising:
[0005] Step S1: Use a large language model to parse various engineering specification clauses and extract key information, and then perform structured processing.
[0006] Step S2: Using the normative clauses as nodes and the strictness comparison relationship between similar normative clauses as edges, establish a semantic knowledge graph of the clauses.
[0007] Step S3: Construct a candidate clause set based on the clause semantic knowledge graph, score the strictness of multiple similar clauses in the candidate clause set, and select the clause with the highest score as the strictest clause.
[0008] Further, step S1 specifically includes:
[0009] Step S11: Collect and preprocess the standard text;
[0010] Step S12: Construct a Prompt template containing the extraction target, and call the large language model to complete the structured extraction of key information of the specification clauses;
[0011] Step S13: Parse the results generated by the large language model and output structured fields in a preset format;
[0012] Step S14: Write the structured fields into the database and vectorize them for subsequent similarity identification and indexing;
[0013] Step S15: Analyze the confidence level of the extraction results and perform necessary human-machine verification.
[0014] Further, step S2 specifically includes:
[0015] Step S21: Calculate the semantic similarity between two clause vectors, and filter out semantically similar clause pairs by comparing them with a preset threshold;
[0016] Step S22: Compare the semantically similar clauses based on their degree of strictness.
[0017] Step S23: Using clauses as nodes, establish edges based on the comparison results of the strictness differences between semantically similar clause pairs to obtain a clause semantic knowledge graph.
[0018] Further, step S22 specifically includes:
[0019] Step S221: Extract the condition boundary expressions in the clause, including the parameter-operator-value triples, and perform logical comparisons according to the degree of strictness of the physical meaning;
[0020] Step S222: Construct a semantic dictionary of restrictive words, map different restrictive words to intensity scores, obtain a comprehensive behavioral intensity score of the clause by weighted summation based on the intensity scores of each restrictive word in the clause, and obtain a comparison result of the strictness difference between clauses with similar semantics based on the comprehensive behavioral intensity scores.
[0021] Further, step S3 specifically includes:
[0022] Step S31: Based on the semantic knowledge graph of the clauses, extract all clauses that are logically similar or have overlapping scopes of application to form a set of candidate clauses;
[0023] Step S32: Calculate the strictness score of the candidate clauses in the candidate clause set according to the defined strictness function of the normative clauses, and select the one with the highest score as the strictest clause.
[0024] Furthermore, the method specifically includes:
[0025] Step S4: Automatically verify and review the survey report based on the most stringent terms obtained.
[0026] Further, step S4 specifically includes:
[0027] Step S41: Automatically generate a review rule expression based on the obtained strictest clause. The review rule expression is used to transform the content of the strictest normative clause into a structured logical expression that can be recognized and automatically executed by the machine.
[0028] Step S42: The extracted survey report data is used as input, and the data fields in the survey report are compared with the review rule expression to achieve automatic review and intelligent feedback of the survey report in terms of standardization and compliance.
[0029] According to the second aspect, one embodiment provides a system for extracting the most stringent canonical rules based on a large language model, the system comprising:
[0030] The clause information extraction module is used to parse and extract key information from various engineering specification clauses using a large language model, and then perform structured processing.
[0031] The knowledge graph construction module is used to build a semantic knowledge graph of the clauses by using the normative clauses as nodes and the strictness comparison relationship between similar normative clauses as edges.
[0032] The strictest clause selection module is used to construct a set of candidate clauses based on the clause semantic knowledge graph, score the strictness of multiple similar clauses in the candidate clause set, and select the clause with the highest score as the strictest clause.
[0033] According to a third aspect, one embodiment provides an electronic device, the device comprising: a processor and a memory;
[0034] The memory is used to store one or more program instructions;
[0035] The processor is configured to run one or more program instructions to perform the steps of a method for extracting the most stringent canonical rules based on a large language model as described in any of the preceding claims.
[0036] According to a fourth aspect, one embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a method for extracting the most stringent canonical rules based on a large language model as described in any of the preceding claims.
[0037] This application provides a method and system for extracting the most stringent normative rules based on a large language model. This method can automatically identify differences between various normative clauses and select the most stringent rule for execution. Through clause information extraction, difference identification, and selection of the most stringent rule, this invention effectively avoids compliance issues caused by differences between norms, providing a more accurate and efficient solution for reviewing survey reports. Attached Figure Description
[0038] Figure 1 A flowchart illustrating a method for extracting the most stringent canonical rules based on a large language model, as provided in one embodiment of the present invention;
[0039] Figure 2 A flowchart illustrating a specific implementation of a method for extracting the most stringent canonical rules based on a large language model, as provided in one embodiment of the present invention;
[0040] Figure 3 This is a structural diagram of a system for extracting the most stringent canonical rules based on a large language model, provided as an embodiment of the present invention. Detailed Implementation
[0041] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of this application. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to this application are not shown or described in the specification. This is to avoid obscuring the core parts of this application with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0042] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.
[0043] The first embodiment of this invention provides a method for extracting the most stringent canonical rules based on a large language model. The following is a combination of... Figure 1 and Figure 2 Please provide a detailed explanation.
[0044] like Figure 1 As shown, in step S1, the large language model is used to parse and extract key information from various engineering specification clauses, and then perform structured processing.
[0045] Clause Information Extraction: This embodiment utilizes a large language model (such as GPT, BERT, or other structured information extraction models) to parse various engineering specifications, automatically extracting structured elements of the specification clauses from unstructured text, including: clause number (TID), clause type (TType), inspection object (O), condition (C), restriction condition (R), and reference clause (Ref). This process guides the model to identify different semantic components in the clauses and annotate fields using a Prompt template. Specifically, the original clause text is processed through input prompts, and the model represents it in structured JSON format, for example:
[0046] {
[0047] "TID":"3.2.1",
[0048] "TType":"Mandatory Clause",
[0049] "O":"Groundwater level",
[0050] "C":"Groundwater level exceeds 5 meters",
[0051] "R": "Reinforcement is necessary".
[0052] "Ref": "See section 4.3.5"
[0053] }
[0054] The overall process of clause extraction includes five steps: First, the standard text is collected and preprocessed, including format standardization and clause segmentation; second, a Prompt template containing the extraction target is constructed and a large language model is used to complete structured extraction; third, the structure fields in JSON format are parsed and output; next, the extraction results are written to a database and vectorized for subsequent similarity identification and indexing; finally, the extraction results are evaluated for confidence and subjected to necessary human-machine verification. This method has advantages such as adaptability to multiple industry standards, high extraction accuracy, and large processing scale, which can significantly improve the efficiency of structured processing of multi-source standard texts and provide a semantically accurate information foundation for difference comparison and selection of the most stringent standard.
[0055] The above steps specifically include:
[0056] Step S11: Collect and preprocess the standard text.
[0057] Objective: To transform multi-source, multi-format specification documents into a unified structure to facilitate subsequent model calls.
[0058] Specific implementation method:
[0059] Supported standard formats include: PDF, Word, HTML, plain text, etc.
[0060] Use regular expressions and document structure parsing tools (such as pdfplumber, python-docx, and BeautifulSoup for Python) to extract the clause text;
[0061] Using a text segmentation algorithm, the specifications are divided into a two-level structure of "chapter-clause";
[0062] Construct a clause block structure, denoted as s for each clause. i The entire specification document is S = {s1, s2, ..., s}. n}
[0063] Principle formula:
[0064] Let the set of original specification documents be:
[0065] D = {d1, d2, ..., d} n}
[0066] The standardized document collection is as follows:
[0067] D std ={F(d1),F(d2),…,F(d n )}
[0068] Each document is divided into a set of clauses:
[0069] T i =S(F(d) i ))={t1,t2,…,t k}
[0070] in:
[0071] d i This represents the i-th document;
[0072] F(·) represents the format normalization function; the format normalization function is a processing module used to convert standardized documents from different sources (such as PDF, Word, HTML, plain text, etc.) into a standardized text format. Its core function is to identify the document type and extract the main text content, removing formatting impurities for subsequent structured processing. Common methods include extracting the main text based on document structure parsing (such as pdfplumber, python-docx, BeautifulSoup, etc.), combining regular expressions to uniformly clean the format, and finally outputting standard plain text content.
[0073] S(·) represents the text segmentation function; the text segmentation function is a function module used to divide standardized specification text into structured clause units. Its basic principle is to automatically segment text fragments based on clause numbering patterns (such as "3.2.1", "Article 4.3", etc.) or semantic prompts (such as "should", "must", "must not", etc.). Common methods include:
[0074] Regular expressions match the clause number format;
[0075] Combine natural language processing tools to identify semantic paragraph boundaries;
[0076] The output is a hierarchical structure of "chapter-clause".
[0077] t j This refers to clause j in the specification.
[0078] Step S12: Construct a Prompt template containing the extraction target, and call the large language model to complete the structured extraction of key information of the specification clauses.
[0079] Objective: To construct guiding prompts so that large language models can explicitly output structured results.
[0080] Specific implementation method:
[0081] Construct template prompts for different specification types. For example, please extract key information from the following specification clauses, including: clause number, type, inspection target, conditions, restrictions, and reference clauses. Please return the information in JSON format.
[0082] 1. Classification of different specification types:
[0083] This method is applicable to standard documents in multiple engineering industries. Common standard types include, but are not limited to: geotechnical engineering standards (such as the "Code for Geotechnical Engineering Investigation" and the "Code for Design of Building Foundations"); railway, highway and other transportation engineering standards (such as the "Code for Geological Investigation of Railway Engineering" and the "Code for Geological Investigation of Highway Engineering"); municipal standards (such as the "Technical Code for Geological Investigation of Urban Rail Transit Engineering"). Various standards have certain differences in expression habits, terminology style and clause structure, so Prompt templates need to be customized according to the standard type.
[0084] 2. Explanation of the construction method and differences of the Prompt template:
[0085] Prompt templates use language-guided large language models to identify and extract structured information. Templates typically include the following elements: a clear task objective (e.g., "Please extract key fields from the following text"); specified field types (e.g., "Clause number, clause type, inspection target, conditions, restrictions, reference clauses"); and output format requirements (e.g., "Please return in JSON format").
[0086] The differences in templates between different specification types are mainly reflected in the following aspects:
[0087]
[0088] Example Prompt template:
[0089] Example of a Prompt for building foundation-related codes:
[0090] Please extract the key information from the following clauses, including: clause number, clause type (mandatory or non-mandatory), inspection object (e.g., foundation, groundwater level), condition description, restrictions (e.g., must, should, must not), and whether other clauses are referenced (e.g., Clause 4.2.1). Please return the information in JSON format.
[0091] Example of a Prompt for railway engineering specifications:
[0092] Please extract structured information from the following railway engineering specifications, including the number, object (such as slope, foundation pit, etc.), geological conditions, engineering measures, and references. The output format should be JSON.
[0093] In summary, Prompt templates are customized prompts for different specification types, aiming to guide language models to accurately extract structured fields based on an understanding of industry-specific language styles. Through differentiated template design, the model's adaptability to various industry specifications and extraction accuracy can be improved.
[0094] Let P represent the Prompt template; Represents the large language model processing function; y i The structured terms output by the model;
[0095] but:
[0096]
[0097] Where: y i ={TID,TType,O,C,R,Ref}, which includes fields such as clause number, type, inspection object, conditions, restrictions, and reference clauses.
[0098] Step S13: Parse the results generated by the large language model and output structured fields in a preset format.
[0099] Objective: To validate, standardize, and transform the structure of the model-generated results for subsequent processing.
[0100] Specific implementation method:
[0101] Convert the text generated by the model to JSON format and verify the integrity of its fields; use schema validation tools (such as Pydantic and Cerberus) to standardize the field format; and visualize the data for manual verification.
[0102] Example structure:
[0103] {
[0104] "TID":"3.2.1",
[0105] "TType":"Mandatory Clause",
[0106] "O":"Groundwater level",
[0107] "C":"Groundwater level exceeds 5 meters",
[0108] "R": "Reinforcement is necessary".
[0109] "Ref": "See section 4.3.5"
[0110] }
[0111] Step S14: Write the structured fields into the database and vectorize them for subsequent similarity identification and indexing.
[0112] Objective: To store structured terms in a database to support subsequent semantic comparison and querying.
[0113] Specific implementation method:
[0114] Write structured fields to databases such as MongoDB and PostgreSQL;
[0115] Vectorize the fields for condition C and constraint R (e.g., using OpenAI Embedding or BERTembedding):
[0116]
[0117] Build vector indexes (such as Faiss, Milvus) to support fast similarity comparison.
[0118] Step S15: Analyze the confidence level of the extraction results and perform necessary human-machine verification.
[0119] Objective: To evaluate the quality of model extraction and assist manual verification with a focus on key aspects.
[0120] Specific implementation method:
[0121] Design a confidence scoring mechanism (such as model output probability, semantic similarity, etc.);
[0122] Set anomaly detection rules (such as empty fields or incorrect format) to trigger manual review;
[0123] Provides a GUI validation interface for field confirmation and editing.
[0124] The purpose of setting up a scoring mechanism in this embodiment is to evaluate the accuracy and reliability of the structured information of each normative clause extracted by the large language model, so as to select high-confidence results for direct application and trigger manual verification for low-confidence results, thereby ensuring the overall extraction quality of the system.
[0125] Specifically:
[0126] The scoring object is each structured clause result (such as the whole composed of TID, TType, O, C, R, Ref fields) extracted and generated by the large language model, rather than the vectorized semantic embedding result.
[0127] The scoring method involves comprehensively scoring individual structured results, without comparing vectorized results. Vectorized embedding is mainly used for similarity comparison between subsequent clauses and is not directly related to the scoring mechanism at this stage.
[0128] The scoring criteria include:
[0129] Model output confidence score (P): Calculated by comprehensively considering the token probabilities output by the language model when generating the content of each field;
[0130] Field logical consistency score (S): Evaluated based on the logical rationality between field contents (such as whether there is consistency between condition C and constraint R).
[0131] The formula for scoring the overall confidence level is as follows:
[0132] Conf(T) = α×P(T) + β×S(T)
[0133] Where α+β=1, the weights are usually evenly distributed.
[0134] Confidence score of the structured extraction results of Conf(T) terms;
[0135] The P(T) model outputs a token-level probability-weighted result; P(T) represents the overall confidence level of the large language model when generating each field. The specific calculation method is as follows:
[0136] The probability of generating each token is calculated when the large language model outputs the content of each field (TID, TType, O, C, R, Ref);
[0137] The average token generation probability is calculated for each field to form the field confidence score.
[0138] The overall clause confidence score P(T) is obtained by taking the weighted average of the confidence scores of all fields.
[0139] The formula is expressed as:
[0140]
[0141] Where n is the number of fields, p i The average token generation probability for the i-th field.
[0142] Example: If the generation probabilities of each field are 0.95, 0.98, 0.92, 0.91, 0.96, and 0.89 respectively, then the overall confidence level is approximately 0.935.
[0143] S(T) is used to measure the logical coherence between the contents of each field in the extraction results. Specific methods include:
[0144] Set standardized logical validation rules, such as condition-restriction consistency, clause type-restriction strength matching, and correctness of reference relationships;
[0145] Check whether the extracted clauses comply with all rules, and calculate the pass rate;
[0146] Calculate the consistency score:
[0147]
[0148] Where MM represents the number of rule items that passed the validation, and NN represents the total number of rule items.
[0149] Example: If 5 validation rules are designed and 4 pass, then S(T) = 0.8.
[0150] When Conf(T) is higher than the set threshold (e.g., 0.85), the structured results pass directly; when it is lower than the threshold, the system automatically triggers manual review.
[0151] In the validation of clause extraction results, this method mainly verifies the following:
[0152] • Field completeness (whether all required fields are included);
[0153] • Field format correctness (e.g., TID number format, Ref reference standardization);
[0154] • Field logical consistency (e.g., whether there is a logical match between the condition description and the restriction requirements);
[0155] • Outlier detection (such as fields being empty, invalid content, etc.).
[0156] Illustrated with examples:
[0157] Taking the regulation clause "When the groundwater level exceeds 5 meters, foundation reinforcement must be carried out" as an example, the structured results extracted by the large language model are as follows:
[0158]
[0159] Assuming the confidence levels for each field during generation are TID (0.95), TType (0.98), O (0.92), C (0.91), R (0.96), and Ref (0.89), the weighted average is P(T) = 0.93. After logical consistency analysis, S(T) = 0.95. Therefore, the overall score is:
[0160] Conf(T)=0.5×0.93+0.5×0.95=0.94
[0161] Since the score is higher than the set threshold, the structured extraction result of this clause can be used directly without manual review.
[0162] In summary, the scoring mechanism set in this embodiment is clearly oriented towards the results of structured clauses, with each clause scored independently, without involving comparisons between vectors, and the scoring process and significance have been explained in detail with examples.
[0163] like Figure 1 As shown, in step S2, the normative clauses are used as nodes, and the strictness comparison relationship between similar normative clauses is used as edges to establish a semantic knowledge graph of the clauses.
[0164] Clause Relationship Extraction and Difference Identification:
[0165] To select the most stringent clauses from multiple standards, the system needs to perform unified modeling and logical mapping of the semantics, structure, and rule strength among the clauses. This mainly includes four core processes: text semantic alignment, condition boundary analysis, constraint strength comparison, and semantic graph construction. Each process integrates specific implementation methods and principle formulas to form a unified automatic identification mechanism.
[0166] The above steps specifically include:
[0167] Step S21: Calculate the semantic similarity between two clause vectors and filter out semantically similar clause pairs by comparing them with a preset threshold.
[0168] Text semantic alignment and similar clause recognition:
[0169] Objective: To determine whether two standard clauses express the same or similar meanings, providing a matching basis for subsequent comparisons of differences in boundaries, strengths, etc.
[0170] Implementation method: Use a pre-trained language model (such as BERT, RoBERTa) to generate a semantic vector for each clause; calculate the cosine similarity between two clause vectors; if the similarity is greater than a set threshold (such as 0.85), then the two clauses are considered to constitute a comparable clause pair.
[0171] There are two clauses:
[0172] T1: The i-th clause in specification A;
[0173] T2: Clause j in specification B;
[0174] Let the semantic vectors of the terms extracted by the language model be as follows:
[0175]
[0176] Where ε(·) is the language model embedding function.
[0177] The semantic similarity between two clauses is the cosine similarity of their vectors:
[0178]
[0179] The matching condition is as follows:
[0180] Sim(T1,T2)≥δ
[0181] in:
[0182] Sim(T1,T2): Semantic similarity between clauses;
[0183] δ: The set similarity threshold, usually 0.85.
[0184] Parameter description:
[0185]
[0186] Example:
[0187] Clause A (from Standard A): "3.2.1 When the groundwater level exceeds 5 meters, foundation reinforcement must be carried out."
[0188] Clause B (from Standard B): "4.1.4 When the groundwater level is higher than 4.5 meters, the foundation shall be reinforced."
[0189] The processing procedure is as follows:
[0190] The model extracts semantic vectors:
[0191]
[0192] Calculate semantic similarity:
[0193]
[0194] Judgment conditions:
[0195] Proceed to subsequent difference analysis
[0196] System behavior summary: When the semantic similarity between two clauses exceeds the threshold, the clause pair (T1,T2) is marked as "semantic similar" and input into the difference comparison module (condition boundary analysis, constraint strength comparison); if the threshold is not reached (e.g., Sim = 0.70 < 0.85), it is excluded to avoid meaningless comparisons.
[0197] Step S22: Compare the semantically similar clauses based on their degree of strictness.
[0198] Step S22 specifically includes:
[0199] Step S221: Extract the condition boundary expressions in the clause, including the parameter-operator-value triples, and perform logical comparisons based on the degree of strictness according to their physical meaning.
[0200] Analysis of differences in the terms and conditions:
[0201] Objective: To identify differences in the stringency of numerical boundaries among similar clauses (e.g., a comparison of groundwater levels >5m versus >4m).
[0202] Method: Use regular expressions or LLM to extract the conditional boundary expressions (parameter-operator-numeric triples) from the clauses; perform logical comparisons based on the degree of strictness according to their physical meaning.
[0203] formula:
[0204]
[0205] Parameter description:
[0206] Val: numerical value;
[0207] Stricter(C1,C2): Determines which condition is more stringent;
[0208] To achieve intelligent comparison of the strictness of conditions, the tools and models used are as follows: Regular expression engine: such as Python's `re` module, used for fast pattern matching; Fine-tuned version of large language model: such as using OpenAI GPT3.5Turbo finetune or T5small finetune model to fine-tune the specification clause dataset to support more complex condition parsing; Logical inference module: a rule engine or logical reasoning program written in Python, combined with a domain knowledge base (a table of correspondence between engineering objects and physical logic);
[0209] C1: refers to the condition field extracted from the first clause (T1) in a semantically similar clause pair;
[0210] C2: Refers to the Condition field extracted from the second clause (T2) in a semantically similar clause pair.
[0211] System behavior: Extract constraints from similar clauses and automatically perform logical parsing and "stricter" judgments in terms of physical semantics.
[0212] Example:
[0213] Continue using the similar clause pairs identified in the previous step:
[0214] Clause A(T1): 3.2.1 When the groundwater level exceeds 5 meters, foundation reinforcement must be carried out.
[0215] The conditional triplet to be extracted is:
[0216] Controlled object: Groundwater level H1
[0217] Operator: >
[0218] Threshold: 5.0 meters
[0219] The triple is represented as (H1,>,5.0);
[0220] Clause B(T2): 4.1.4 When the groundwater level is higher than 4.5 meters, the foundation shall be reinforced.
[0221] The extracted triplet is (H2,>,4.5);
[0222] Strictness judgment process:
[0223] Since both control the same object (groundwater level), the comparison direction is "the smaller the level, the stricter the control" (the lower the water level, the more dangerous the situation). Therefore, the comparison is as follows:
[0224] Stricter((H,>,5.0),(H,>,4.5))=(H,>,4.5)
[0225] In other words, Clause B has stricter conditions.
[0226] In this embodiment, when performing boundary difference analysis of clause conditions, the system automatically determines the comparison direction rule ("smaller is more stringent", "larger is more stringent") corresponding to each control object based on the built-in physical logic knowledge base of engineering objects, so as to intelligently judge the stringency of the conditions.
[0227] Step S222: Construct a semantic dictionary of restrictive words, map different restrictive words to intensity scores, obtain a comprehensive behavioral intensity score of the clause by weighted summation based on the intensity scores of each restrictive word in the clause, and obtain a comparison result of the strictness difference between clauses with similar semantics based on the comprehensive behavioral intensity scores.
[0228] Limitation strength identification and comparison:
[0229] Objective: To assess the strength of "obligations to act" in similar clauses, such as the differences between "must," "shall," and "may be considered."
[0230] method:
[0231] Construct a semantic dictionary of restricted words (or use LLM classification);
[0232] Map different limiting words to intensity scores;
[0233] A comprehensive score for the intensity of the behavior is derived.
[0234] formula
[0235]
[0236] Parameter description:
[0237] T i Terms and conditions text;
[0238] s k The semantic score of the first limiting word, such as "must" is 1.0, "should" is 0.6, and "suggest" is 0.2;
[0239] w k Context weight (usually 1);
[0240] Strength (T) i ): The intensity of the clause behavior.
[0241] System behavior: When semantics are similar and condition boundaries are close, the clause with stronger restrictive behavior is preferred as the "stricter clause".
[0242] Step S23: Using clauses as nodes, establish edges based on the comparison results of the strictness differences between semantically similar clause pairs to obtain a clause semantic knowledge graph.
[0243] Clause semantic graph construction:
[0244] Objective: To unify the management of alignment, strength and weakness relationships, and conflict relationships among clauses in different standards, forming a knowledge graph to support subsequent reasoning and selection.
[0245] method:
[0246] Treat the clauses as nodes in the graph;
[0247] Establish multiple edge types: stricterThan, conflict, and equivalentTo;
[0248] Condition: An edge is established only if the similarity is high and the strength or boundary judgment is satisfied.
[0249] Edge establishment logic:
[0250]
[0251] Parameter description:
[0252]
[0253]
[0254] This formula means: "If two clauses are very similar, and the first clause is more binding, then the first clause is considered to be stricter than the second."
[0255] Example:
[0256] Suppose there are two clauses:
[0257] Clause A(T1): Reinforcement is required when the groundwater level is greater than 4 meters;
[0258] Clause B(T2): Reinforcement shall be carried out when the groundwater level is greater than 4 meters;
[0259] The system will do the following:
[0260] Semantic similarity:
[0261] Both A and B are referring to the same object (groundwater level) and condition (>4 meters).
[0262] Therefore, Sim(T1,T2)≈1.0, which is higher than the threshold θ1=0.85.
[0263] Comparison of limiting strengths:
[0264] The intensity score for "must" is 1.0.
[0265] The intensity score for "should" is 0.6.
[0266] Therefore, Strength(T1) > Strength(T2).
[0267] in conclusion:
[0268] Since A and B are similar in expression, but A has stronger restrictions, the system adds an edge to the graph:
[0269] T1 → (stricter than...) → T2
[0270] like Figure 1 As shown, in step S3, a candidate clause set is constructed based on the clause semantic knowledge graph. The strictness scores of multiple similar clauses in the candidate clause set are calculated, and the clause with the highest score is selected as the strictest clause.
[0271] The most stringent standard selection:
[0272] Based on the difference identification results, the system automatically selects the most stringent standard for execution. For standards with conflicting conditions, the system selects the most stringent condition according to preset rules and priorities. For example, if standard A requires "reinforcement when the groundwater level exceeds 5 meters," while standard B requires "reinforcement when the groundwater level exceeds 4 meters," the system will choose to execute the requirement in standard B to ensure that the most stringent standard is followed.
[0273] The above steps specifically include:
[0274] Step S31: Based on the semantic knowledge graph of the clauses, extract all clauses that are logically similar or have overlapping scope of application to form a set of candidate clauses.
[0275] Step S32: Calculate the strictness score of the candidate clauses in the candidate clause set according to the defined strictness function of the normative clauses, and select the one with the highest score as the strictest clause.
[0276] Goal to be achieved:
[0277] This section aims to automatically select the clause with the most stringent restrictions from multiple similar clauses as the basis for execution, based on the results of clause relationship extraction and difference identification in the previous stage, and generate review rules for automatic verification of reports.
[0278] Principles and selection formulas:
[0279] (1) Strictness function of normative clauses:
[0280] Definition Clause T i The "canonical strictness function" is:
[0281] Strictness (T) i )=λ1·CondScore(T i )+λ2·RestrictScore(T i )+λ3·RiskWeight(T i )
[0282] The meanings of each parameter are as follows:
[0283] <![CDATA[T i ]]> Article i <![CDATA[CondScore(T i )]]> The "severity" of the conditions is rated (e.g., the lower the water level threshold, the higher the score). <![CDATA[RestrictScore(T i ]]> Limit the intensity scores of the language, for example, "must" = 1.0, "should" = 0.7, "may" = 0.4 <![CDATA[RiskWeight(T i )]]> The weighting factor under the risk scenario indicates the importance of the clause. <![CDATA[λ1,λ2,λ3]]> <![CDATA[Weight coefficients, satisfying λ1 + λ2 + λ3 = 1]]>
[0284] The Restriction Score is determined by identifying restrictive terms (such as "must," "should," "should," and "may") in the clause text and mapping different terms to corresponding intensity scores based on a pre-defined restriction dictionary (e.g., "must" = 1.0, "should" = 0.7, "should" = 0.4, and "may" = 0.2). When a clause contains multiple restrictive terms, the system typically takes the score corresponding to the word with the highest intensity as the overall restriction strength score of the clause, supporting the selection of the most stringent clause.
[0285] The risk scenario weighting factor is automatically assigned based on the engineering scenario. The system presets the weights corresponding to different risk scenarios (such as extremely high risk 1.2, high risk 1.1, normal risk 1.0, etc.) and uses them as multipliers to adjust the final score when scoring the strictness of the clauses, so as to prioritize the selection of stricter clauses under high-risk conditions.
[0286] (2) Logic for selecting the most stringent clause:
[0287] The system will structure the candidate clause set As input, the highest-scoring T is automatically selected based on the scoring function. * As the strictest terms.
[0288] Implementation method flow:
[0289] Constructing a candidate clause set: Based on the clause semantic graph, extract all clauses that are logically similar or have overlapping scopes of application to form a set.
[0290]
[0291] Rating Quantification:
[0292] Using regular expression templates or model fine-tuning techniques, condition fields (such as "groundwater level exceeds 5 meters") are parsed into structured conditions and scored.
[0293] Conditional Score (CondScore): For example Where h is the water level threshold (e.g., 5m→0.2, 4m→0.25); In addition to the severity score based on numerical normalization, the system can also use logical complexity score, natural language reasoning strength score, experience weight score and multi-condition comprehensive score, etc., to flexibly adjust according to the actual project and improve the intelligence and adaptability of the clause severity assessment.
[0294] RestrictScore: Triggered by keyword-based dictionary mapping;
[0295] Risk weights are derived from expert experience or industry rule bases. This method does not manually set weights for each clause individually, but rather assigns weights in batches based on the risk scenario category to which the clause belongs. For example, according to industry standards, clauses on high-risk factors such as groundwater level, foundation stability, and slope protection are uniformly assigned higher weights (e.g., 0.9), while clauses on general construction requirements and material selection are assigned lower weights (e.g., 0.5). Scenario classification and weight standards are set by experts or with reference to existing industry standard documents (such as the "Standard for Risk Classification of Building Engineering" and the "Guidelines for Risk Clauses in Surveying and Mapping Specifications") to ensure consistency in batch processing and application, avoiding manual labeling of each clause individually.
[0296] Strictness Calculation and Selection:
[0297] right Each clause in the document is scored using a strictness formula, and the clause with the highest score is selected as T. * .
[0298] This method also includes step S4, which automatically verifies and reviews the survey report based on the most stringent terms obtained.
[0299] After selecting the most stringent standard, the system generates a verification rule and provides it to the user. The verification rule can be expressed using conditional expressions, such as "When the groundwater level is greater than 5 meters, foundation reinforcement must be carried out." The system generates this rule based on the selected most stringent standard and verifies it against data from the actual survey report.
[0300] Further, step S4 specifically includes:
[0301] Step S41: Automatically generate a review rule expression based on the obtained strictest clause. The review rule expression is used to transform the content of the strictest normative clause into a structured logical expression that can be recognized and automatically executed by the machine.
[0302] Step S42: The extracted survey report data is used as input, and the data fields in the survey report are compared with the review rule expression to achieve automatic review and intelligent feedback of the survey report in terms of standardization and compliance.
[0303] Review rule generation mechanism:
[0304] The system is based on the strictest terms T * Automatically generate review rule expressions. The rule expressions mentioned in this method refer to the transformation of the most stringent regulatory clauses into a structured logical expression that can be recognized and automatically executed by machines. They are typically represented in JSON format and contain two core parts: a complete condition and an action. For example, the condition field describes the triggering condition (e.g., water level > 4 meters), and the action field describes the measures to be taken (e.g., foundation reinforcement is mandatory).
[0305] Specific examples are as follows:
[0306]
[0307] The above structure ensures the integrity of the rule expression content, with clear fields, logical clarity, and the ability to directly match and verify data. There are no missing fields, and it can be directly used for automated survey report verification.
[0308] Automatic verification and feedback mechanism:
[0309] The system uses extracted survey report data as input, for example:
[0310] {
[0311] "water_level":5.3,
[0312] "foundation_type":"raft"
[0313] }
[0314] After matching the rules, perform validation:
[0315] Additional matching rules:
[0316] In this method, the "rule" refers to a structured rule expression generated by the system according to the most stringent normative clauses. It usually contains two parts: triggering condition and required action, and is stored in JSON structure.
[0317] For example:
[0318]
[0319] The specific matching process of the automatic verification and feedback mechanism is as follows:
[0320] Condition Check:
[0321] Analyze the survey report data, extract the corresponding field values (e.g., water_level is actually 5.3 meters), and compare them according to the logical conditions in the rules (e.g., ">4") to determine whether the triggering conditions are met;
[0322] Action Check:
[0323] If the conditions are met, further verify whether the report contains the specified processing actions (such as the foundation field should contain expressions such as "reinforce" or "must_reinforce").
[0324] Matching result judgment and feedback output:
[0325] If the conditions are met and the action is correct, mark it as "compliant with the most stringent standards";
[0326] If the conditions are met but the action is missing or incorrect, mark it as "non-compliant with specifications" and automatically generate feedback prompts, such as "The current water level has exceeded the specification limit and foundation reinforcement is required."
[0327] If the condition is not met, it is considered that the specification clause does not need to be executed, and no exception is reported.
[0328] In summary, this method, in its automatic verification process, compares the data fields in the survey report with the condition-action structure of the rule expression line by line to achieve automatic review and intelligent feedback on compliance.
[0329] If the report does not record corresponding measures, it will be marked as "does not meet the most stringent standards" and the following feedback will be output:
[0330] "The current water level is 5.3m, which exceeds the most stringent specification requirement (4m). It is recommended to reinforce the foundation."
[0331] If no reinforcement is provided, the statement reads: "This does not meet the specifications and the foundation should be reinforced according to the most stringent standards."
[0332] Corresponding to the aforementioned method for extracting the most stringent canonical rules based on a large language model, this invention also discloses a system for extracting the most stringent canonical rules based on a large language model, such as... Figure 3 As shown, it specifically includes:
[0333] The clause information extraction module is used to parse and extract key information from various engineering specification clauses using a large language model, and then perform structured processing.
[0334] The knowledge graph construction module is used to build a semantic knowledge graph of the clauses by using the normative clauses as nodes and the strictness comparison relationship between similar normative clauses as edges.
[0335] The strictest clause selection module is used to construct a set of candidate clauses based on the clause semantic knowledge graph, score the strictness of multiple similar clauses in the candidate clause set, and select the clause with the highest score as the strictest clause.
[0336] It should be noted that for a detailed description of the most stringent canonical rule extraction system based on a large language model provided in the embodiments of the present invention, please refer to the relevant description of the most stringent canonical rule extraction method based on a large language model provided in the embodiments of this application, which will not be repeated here.
[0337] In addition, embodiments of the present invention also provide an electronic device, the device comprising: a processor and a memory; the memory for storing one or more program instructions; the processor for executing one or more program instructions to perform the steps of a method for extracting the most stringent canonical rules based on a large language model as described in any of the preceding embodiments.
[0338] It should be noted that for a detailed description of an electronic device provided in the embodiments of the present invention, please refer to the relevant description of a method for extracting the most stringent normative rules based on a large language model provided in the embodiments of this application, which will not be repeated here.
[0339] In addition, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the most stringent canonical rule extraction method based on a large language model as described in any of the preceding claims.
[0340] It should be noted that for a detailed description of a computer-readable storage medium provided in the embodiments of the present invention, please refer to the relevant description of a method for extracting the most stringent canonical rules based on a large language model provided in the embodiments of this application, which will not be repeated here.
[0341] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.
[0342] The above examples illustrate the present invention only to aid in understanding it and are not intended to limit the scope of the invention. Those skilled in the art can make various simple deductions, modifications, or substitutions based on the principles of this invention.
Claims
1. A method for extracting the most stringent canonical rules based on a large language model, characterized in that, The method includes: Step S1: Use a large language model to parse various engineering specification clauses and extract key information, and then perform structured processing. Step S2: Using the normative clauses as nodes, establish edges based on the comparison relationship of the strictness differences between similar clauses, and construct a semantic knowledge graph of the clauses; Step S3: Construct a candidate clause set based on the clause semantic knowledge graph, score the strictness of multiple similar clauses in the candidate clause set, and select the clause with the highest score as the strictest clause. in: Step S2 specifically includes: Step S21: Calculate the semantic similarity between two clause vectors, and filter out semantically similar clause pairs by comparing them with a preset threshold; Step S22: Compare the semantically similar clauses based on their degree of strictness. Step S23: Using clauses as nodes, establish edges based on the comparison results of the strictness differences between semantically similar clause pairs to obtain a clause semantic knowledge graph; Step S22 specifically includes: Step S221: Extract the condition boundary expressions in the clause, including the parameter-operator-value triples, and perform logical comparisons according to the degree of strictness of the physical meaning; Step S222: Construct a semantic dictionary of restrictive words, map different restrictive words to intensity scores, obtain a comprehensive behavioral intensity score of the clause by weighted summation based on the intensity scores of each restrictive word in the clause, and obtain a comparison result of the strictness difference based on the comprehensive behavioral intensity scores of semantically similar clauses. Step S3 specifically includes: Step S31: Based on the semantic knowledge graph of the clauses, extract all clauses that are logically similar or have overlapping scopes of application to form a set of candidate clauses; Step S32: Calculate the strictness score of the candidate clauses in the candidate clause set according to the defined strictness function of the normative clauses, and select the one with the highest score as the strictest clause. The method further includes: Step S4: Automatically verify and review the survey report based on the most stringent terms obtained.
2. The method for extracting the most stringent canonical rules based on a large language model as described in claim 1, characterized in that, Step S1 specifically includes: Step S11: Collect and preprocess the standard text; Step S12: Construct a Prompt template containing the extraction target, and call the large language model to complete the structured extraction of key information of the specification clauses; Step S13: Parse the results generated by the large language model and output structured fields in a preset format; Step S14: Write the structured fields into the database and vectorize them for subsequent similarity identification and indexing; Step S15: Analyze the confidence level of the extraction results and perform human-machine verification.
3. The method for extracting the most stringent canonical rules based on a large language model as described in claim 2, characterized in that, Step S4 specifically includes: Step S41: Automatically generate a review rule expression based on the obtained strictest clause. The review rule expression is used to transform the content of the strictest normative clause into a structured logical expression that can be recognized and automatically executed by the machine. Step S42: The extracted survey report data is used as input, and the data fields in the survey report are compared with the review rule expression to achieve automatic review and intelligent feedback of the survey report in terms of standardization and compliance.
4. A system for extracting the most stringent canonical rules based on a large language model, characterized in that, The system is used to implement the method as described in any one of claims 1 to 3, comprising: The clause information extraction module is used to parse and extract key information from various engineering specification clauses using a large language model, and then perform structured processing. The knowledge graph construction module is used to build a semantic knowledge graph of the clauses by using the normative clauses as nodes and the strictness comparison relationship between similar normative clauses as edges. The strictest clause selection module is used to construct a set of candidate clauses based on the clause semantic knowledge graph, score the strictness of multiple similar clauses in the candidate clause set, and select the clause with the highest score as the strictest clause.
5. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is configured to run one or more program instructions to perform the steps of the most stringent canonical rule extraction method based on a large language model as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for extracting the most stringent canonical rules based on a large language model as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Bridge field construction scheme examination method based on large model and knowledge graph
CN118411016A
Construction scheme compliance auditing system and method based on knowledge graph and large model
CN118643168A