A text generation method and system for the mining industry with strong factual constraints
By constructing a knowledge graph for the mining industry and a post-verification error correction mechanism, the problem of factual bias in text generation in the mining industry is solved, and the accuracy and adaptability of text generation are achieved. It is applicable to scenarios such as mine equipment operation and maintenance, safe operation and geological risk assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-03
AI Technical Summary
Existing text generation methods cannot effectively solve the factual bias problem when applied in the mining field, have high cross-scenario migration costs, and cannot meet the stringent requirements of the mining field for factual accuracy and information integrity.
Construct a knowledge graph for the mining industry, define core entities and relationships between entities, establish a dedicated fact base, generate text through semantic matching and structured prompts, and perform post-validation and error correction to ensure that the text conforms to the strong factual constraints of the mining industry.
It effectively avoids factual illusions and parameter errors in text generation in the mining field, reduces the content error rate, and improves the practicality and adaptability of text generation, enabling it to meet the strong factual constraint requirements of different scenarios such as mine equipment operation and maintenance, safety supervision, and geological exploration.
Smart Images

Figure CN121524339B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text generation technology, and in particular to a text generation method and system for the mining industry that addresses the need for strong factual constraints. Background Technology
[0002] In scenarios with strong factual constraints, such as mine production, equipment operation and maintenance, safety supervision, and geological exploration, text generation must strictly adhere to core facts such as mining industry standards, equipment technical parameters, and safety operation procedures. For example, equipment operation and maintenance reports need to accurately match equipment quota parameters and fault handling standards, safety operation guidelines need to strictly conform to industry safety regulations, and geological risk assessments need to completely restore geological structural data and risk level classifications. Traditional Retrieval Augmented Generation (RAG) methods and their improvements have significant limitations when applied in the mining field: the retrieval stage uses semantic similarity as the core indicator, which easily recalls non-core information (such as anecdotes about equipment use and non-standard operation cases), crowding out the weight of core industry facts; the screening stage lacks mining-specific factual standards, which may lead to the use of documents that are "semantically related but have incorrect parameters" as the basis for generation; the generation stage lacks structured factual guidance, which can easily lead to "factual illusions" such as parameter bias and incorrect reference to regulations, and there is no post-correction mechanism, making it difficult to meet the stringent requirements of the mining field for factual accuracy and information completeness.
[0003] Existing graph-augmented RAG methods focus on semantic retrieval optimization, failing to design constraint mechanisms for the differences in the importance of core facts in the mining domain. Furthermore, their graph structures rely on manual definition, resulting in high costs for cross-scenario migration and an inability to effectively address the factual bias problem in text generation within the mining domain. Therefore, a text generation method adapted to the strong factual constraints required by the mining domain is urgently needed. Summary of the Invention
[0004] This invention provides a text generation method and system for the mining industry, which addresses the problems of high cross-scenario migration costs and inability to effectively resolve factual biases in text generation in the mining industry.
[0005] To achieve the above objectives, the present invention employs the following technical solution:
[0006] In a first aspect, the present invention provides a text generation method for the mining industry that addresses the need for strong factual constraints, comprising:
[0007] S1. Construct a knowledge graph for the mining field, define core entities and core relationships between entities in the knowledge graph, construct a core fact set based on the core entities and core relationships between entities, and establish a dedicated fact base based on the core fact set.
[0008] S2. Obtain candidate search documents corresponding to the user's query command, perform named entity recognition on the candidate search documents to obtain key entity information of the documents, calculate the matching degree between the key entity information of the documents and the exclusive fact base, and filter the top-k documents from the candidate search documents based on the matching degree. Filter the top-k documents with the highest matching degree based on a preset selection number as reference documents, where k is the preset selection number.
[0009] S3. Integrate the reference documents and the core fact set in the dedicated fact base into structured prompt words, input the structured prompt words into the large language model, use the large language model to output the initial text from the dedicated fact base, and perform posterior verification and error correction on the initial text to obtain the final text that conforms to the strong fact constraints of the mining field.
[0010] Optionally, in S1, the core entities in the mining field include: mining equipment, geological structure, safety regulations, and work processes. The core relationships between these entities include: mining equipment - operation and maintenance parameters, geological structure - risk level, safety regulations - work requirements, and work processes - time nodes.
[0011] Optionally, in S1, the construction of a core fact set based on the core entities in the mining field and the core relationships between the entities includes:
[0012] Based on the core entities in the mining field and the core relationships between them, the content of mining industry standard texts is integrated to obtain a set of core facts.
[0013] Optionally, in S2, the matching degree between the key entity information of the document and the dedicated fact base is calculated, and Top-k documents are filtered based on the matching degree, including:
[0014] Traverse the core fact set in the dedicated fact base, input the document key entity information and the core fact set into the semantic matching degree model, set a matching degree threshold, filter the fact documents in the core fact set with a matching degree lower than the matching degree threshold, and obtain candidate search documents and matching degree scores between the candidate search documents and the document key entity information;
[0015] The candidate retrieval documents and key entity information of the documents are input into the semantic relevance model to obtain the semantic relevance score between the candidate retrieval documents and key entity information of the documents.
[0016] Based on the matching score and semantic relevance score, a weighted fusion algorithm is used to calculate the final score between the candidate search documents and the key entity information of the documents, and the Top-k documents are selected according to the final score. The weighted fusion algorithm calculates the following relationship:
[0017] ;
[0018] in, , These are hyperparameters used in the final score calculation. To evaluate the semantic relevance score output by the model, A score is given to the degree to which the document matches the core facts. This is the final score;
[0019] The Top-k documents are candidate documents ranked from highest to lowest score, and k is the preset number of documents to select.
[0020] Optionally, in S3, the integration of the reference document with the core fact set in the dedicated fact base into structured prompt words includes:
[0021] The text generation instruction is determined based on the user's query instruction. Document fragments are extracted from the reference document based on the text generation instruction. The corresponding core facts are determined in the dedicated fact base based on the document fragments, and a structured prompt word of instruction-document-fact is constructed.
[0022] Optionally, in S3, the initial text undergoes posterior verification and error correction to obtain a final text that conforms to strong factual constraints in the mining field, including:
[0023] The relevance assessment model is invoked to evaluate the initial text, and the content relevance score between the initial text and the structured prompt words is obtained;
[0024] The coverage ratio of the initial text to the core facts in the proprietary fact base is determined by attention calibration.
[0025] The average text similarity between the initial text and the core facts in the dedicated fact base is calculated by comparing the main clauses.
[0026] The text quality of the initial text is quantified using a comprehensive scoring formula to obtain a text score. The comprehensive scoring formula satisfies the following relationship:
[0027] ;
[0028] in, To score content relevance, The coverage ratio of core facts, This represents the average text similarity between the initial text and the core facts in the dedicated fact base. , and These are all hyperparameters used in the calculation of the overall score. Score the text;
[0029] The final text, which conforms to the strong factual constraints of the mining field, is obtained based on the text score.
[0030] Optionally, based on the text score, the final text that conforms to strong factual constraints in the mining field is obtained, including:
[0031] A preset overall score threshold is set, and the text scores are compared with the overall score threshold.
[0032] when When the value is below a preset threshold, the initial text will be rolled back to output the core facts corresponding to the dedicated fact base, and the reason for the rollback will be marked.
[0033] when When the value exceeds the threshold, the core facts missing in the initial text are supplemented based on the structure of the structured prompt words, and the complete text is output as the final text.
[0034] Optionally, the semantic relevance model is trained based on maximizing the reflective token, with the training objective being to maximize the conditional probability likelihood of the reflective token. The training formula is as follows:
[0035] ;
[0036] in, It is a semantic relevance model. It is the expectation operator, applied to the training dataset. The average of the samples is taken. It is the training dataset, containing samples. , It is task input, It generates text. ReflectionToken is used to represent the relevance and accuracy of a paragraph. It is the logarithmic probability. This is the expected value.
[0037] Optionally, a relevance assessment model can be invoked to evaluate the initial text, including:
[0038] The semantic vectors of the initial text and user needs are extracted by a relevance assessment model, and the basic score of the initial text is determined by cosine similarity. The coverage of key entity information in the initial text is counted, and the keyword coverage rate of key entity information in the initial text is determined based on the coverage. The content relevance score is obtained by weighting the basic score and the keyword coverage rate.
[0039] Secondly, embodiments of this application provide a text generation system for the mining industry with strong factual constraints, including a processor and a memory;
[0040] Memory, used to store computer programs;
[0041] When a processor executes a program stored in memory, it implements any of the steps of the method described in the first aspect.
[0042] Beneficial effects:
[0043] This invention provides a text generation method for the mining industry, addressing the strong factual constraints required in the field. It constructs a mine-specific knowledge graph (KG) to establish a dedicated fact base as a unified factual benchmark. Combining semantic relevance and KG fact matching for dual-dimensional filtering, along with a closed-loop constraint of structured keyword injection guiding generation and post-generation verification and error correction, it effectively avoids problems such as "fact illusions," parameter errors, and deviations in procedure citations in mine-specific text generation. This method adopts a "general architecture + domain parameter configuration" model, requiring no reconstruction of the technical framework. It only adjusts the definitions of core entity relationships in the mining field (such as equipment-maintenance parameters, geological structure-risk level, safety procedures-operational requirements, etc.) and weighted scoring weights. By adjusting parameters such as weight and fact verification rules, this method can flexibly adapt to different scenarios with strong factual constraints, such as mine equipment operation and maintenance, safety supervision, and geological exploration, demonstrating strong domain adaptability. Furthermore, the text generated by this method strictly conforms to mining industry norms and technical standards while possessing sufficient detail and logical coherence. It can be directly applied to actual production scenarios such as mine equipment operation and maintenance reports, safety operation guidelines, and geological risk assessment documents, significantly reducing manual writing costs and content error rates, and improving the practicality of the generated text. In addition, this method supports dynamic updates to mine key data (KG), enabling it to flexibly incorporate new equipment parameters, new industry regulations, and new geological data as mining technology develops and standards iterate, demonstrating strong scalability. Attached Figure Description
[0044] Figure 1 A flowchart illustrating a preferred embodiment of the text generation method for the mining industry that addresses the strong factual constraint requirements;
[0045] Figure 2 This is a flowchart of a preferred embodiment of the present invention;
[0046] Figure 3 This is a diagram of the evidence screening framework of the KG-ERC module in a preferred embodiment of the present invention.
[0047] Figure 4 This is a diagram illustrating the generation and error correction framework of the KG-FCG module in a preferred embodiment of the present invention. Detailed Implementation
[0048] The technical solution of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms "an" or "a" and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms "connected" or "linked" and similar terms are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up," "down," "left," "right," etc., are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship also changes accordingly.
[0050] Please see Figures 1 to 4 This application provides a text generation method for the mining industry, which addresses the need for strong factual constraints. The method includes:
[0051] S1. Construct a knowledge graph for the mining field, define core entities and core relationships between entities in the knowledge graph, construct a core fact set based on the core entities and core relationships between entities, and establish a dedicated fact base based on the core fact set.
[0052] S2. Obtain candidate search documents corresponding to the user's query command, perform named entity recognition on the candidate search documents to obtain key entity information of the documents, calculate the matching degree between the key entity information of the documents and the exclusive fact base, and filter the top-k documents from the candidate search documents based on the matching degree. Filter the top-k documents with the highest matching degree based on a preset selection number as reference documents, where k is the preset selection number.
[0053] S3. Integrate the reference documents and the core fact set in the dedicated fact base into structured prompt words, input the structured prompt words into the large language model, use the large language model to output the initial text from the dedicated fact base, and perform posterior verification and error correction on the initial text to obtain the final text that conforms to the strong fact constraints of the mining field.
[0054] In a preferred embodiment of the present invention, a core entity in the mining field, namely mining equipment, is used as an example. Based on the WJ-2B underground internal combustion loader user manual and relevant industry standards for mining equipment operation and maintenance, a dedicated knowledge graph (KG) is constructed.
[0055] This embodiment uses the WJ-2B underground internal combustion loader as an example to generate a corresponding maintenance guide for the WJ-2B underground internal combustion loader. The specific steps are as follows:
[0056] S1. Construct a knowledge graph for the mining domain, defining core entities and core relationships between entities within the knowledge graph, and building a core fact set based on the core entities and their relationships. A dedicated fact base is then established based on this core fact set. Specifically, this includes:
[0057] S11: Construct a dedicated knowledge graph and core fact base for the WJ-2B loader.
[0058] S12: Define the core entities and core relationships between entities in the mining field: Taking mining equipment as the core entity category, focusing on the WJ-2B underground internal combustion loader, clarify its subordinate sub-entity categories (equipment body, technical parameters, oil specifications, maintenance cycle, common faults, operating procedures), specifically including subsystems such as engine, hydraulic torque converter, power transmission, drive axle, hydraulic system, braking system, electrical system, etc., rated load capacity, maintenance cycle and other key information, as shown in Table 1;
[0059] At the same time, the core relationship between mining equipment and operation and maintenance parameters is defined to form a specific relationship mapping (such as "engine oil - change every 250 hours" and "hydraulic system - Great Wall Zhuoli 46# anti-wear hydraulic oil", as shown in Table 2).
[0060] S13: Constructing a set of core facts: Based on the above core entities and relationships, integrate mining industry standard texts such as the "WJ-2B Underground Internal Combustion Loader Operation and Maintenance Manual" and the "Mining Equipment Periodic Maintenance Industry Standard" to extract four categories of fact descriptions: "Maintenance, Oil, Fault, and Safety". Ensure that each fact corresponds to an entity-relationship mapping (e.g., "Air filter cleaned every 50 hours and replaced every 300 hours" corresponds to the "Equipment-Maintenance Cycle" relationship), forming a set containing four core facts, as shown in Table 3.
[0061] S14: Establish a dedicated fact base: Store the core fact set in a structured manner according to "fact category-entity-relationship-fact description" to form a dedicated fact base for the WJ-2B loader, which will serve as the fact benchmark for subsequent document matching and text verification.
[0062] The core entity definition is referenced in Table 1, and the entity relationship is referenced in Table 2. In Table 1, the main body of the equipment, technical parameters, oil specifications, maintenance cycle, common faults, and operating procedures are all subcategories within the core entity category of mining equipment.
[0063] Table 1. Definition of Core Entities (Mining Equipment)
[0064]
[0065] It is also worth noting that for core entities such as geological structure, safety regulations, and work procedures,
[0066] Table 2 Entity Relationship Definitions (Mining Equipment - Operation and Maintenance Parameters)
[0067]
[0068] The relationship definitions extracted in Table 2 are all subordinate branches of the main category "Mining Equipment - Operation and Maintenance Parameters". In addition to specific parameter values, operation and maintenance parameters also include operation and maintenance related procedures. Among them, technical parameters and oil requirements are parameter values, while maintenance cycle, troubleshooting methods, and safe operation are operation and maintenance related procedures.
[0069] The specific relationship mappings in Table 2 integrate the relevant content in the mining industry standards. Other relationships, such as geological structure-risk level, safety procedures-operation requirements, and operation process-time nodes, can be extracted in the same way. Here, we only use the WJ-2B underground internal combustion loader in mining equipment as an example. Other entities and relationships will not be elaborated on.
[0070] Based on the entities and relationships in Tables 1 and 2, relevant content from the WJ-2B underground internal combustion loader's user manual is integrated to form a structured fact base as shown in Table 3:
[0071] Table 3 Structured Fact Base
[0072]
[0073] The core facts corresponding to core entities such as geological structure, safety regulations, and work procedures can all be extracted from the corresponding mining industry normative documents in the manner described above. Mining industry normative documents include mining industry standards, equipment technical manuals, geological exploration reports, and safety operation rules.
[0074] In the preferred embodiment of the present invention, the first focus is on constructing parameters, usage, maintenance and upkeep of mining equipment to ensure factual consistency and information integrity between the retrieved content and the generated content.
[0075] S2. Obtain candidate search documents corresponding to the user's query command, perform named entity recognition on the candidate search documents to obtain key entity information of the documents, calculate the matching degree between the key entity information of the documents and the dedicated fact base, and filter Top-k documents from the candidate search documents based on the matching degree. The Top-k documents with the highest matching degree are selected as reference documents based on a preset selection quantity, where k is the preset selection quantity. Specifically, this includes:
[0076] S21: Obtain candidate search documents: For the user query "WJ-2B Underground Internal Combustion Shovel Maintenance Guide", obtain relevant candidate search documents through the search engine, including core chapters of the equipment maintenance manual, industry maintenance standards, and similar equipment operation and maintenance cases.
[0077] S22: Extract key entity information from documents: Perform Named Entity Recognition (NER) on candidate search documents to extract key entities, covering entity information that is strongly related to the operation and maintenance of mining equipment, such as equipment model (WJ-2B), core components (engine, hydraulic system), maintenance cycle (250 hours / 500 hours, etc.), oil specifications (Great Wall Zhuoli 46# anti-wear hydraulic oil), and operating procedures (filter replacement, oil filling requirements).
[0078] S23: Calculate the fact matching score: Traverse the dedicated fact base built in S1, input the extracted key entity information of the documents and the core fact set into the semantic matching score model, set the matching score threshold to 0.6 (this is set according to the fact matching benchmark in the mining field, and can be adjusted adaptively in actual application), filter low-relevance fact documents with a matching score lower than 0.6, such as maintenance cases of non-WJ-2B model loaders and non-standard operating experience, to obtain new candidate search documents and corresponding matching scores.
[0079] S24: Calculate semantic relevance score: Input the new candidate retrieval documents and key entity information of the user query into the semantic relevance model (Ft_t5 model) fine-tuned by the mine operation and maintenance corpus, and output the semantic relevance score between each document and the query.
[0080] Weighted fusion filtering of Top-k documents: The final score is calculated using a weighted fusion algorithm, and the formula is as follows:
[0081] ;
[0082] in , These are hyperparameters; in one embodiment, , , This represents the semantic relevance score of the evaluation model output, with a value ranging from 0 to 1. This indicates the degree of fact matching between the document and the KG core fact set, with a value ranging from 0 to 1.
[0083] Based on the final scores, the documents are sorted from highest to lowest, and the Top-k documents are selected, where k is the number of documents selected. In this example, k=5 is used as an example to illustrate the selection, so that the Top-5 documents are obtained as reference documents for subsequent text generation.
[0084] In a preferred embodiment of the present invention, an Ft_t5 model is trained as an evaluation model for the mining domain, using an evaluation model training fine-tuning method. The training objective is a language model based on maximum likelihood estimation. The core objective of the evaluation model is to learn to predict ReflectionTokens, i.e., to determine whether a retrieval is needed, the relevance of the retrieval paragraph, and the support of the generated text based on the input (task instructions, generated text, retrieval paragraphs, etc.). Its training objective is to maximize the conditional probability likelihood of the reflection tokens, as follows:
[0085]
[0086] in It is an evaluation model. It is the expectation operator, for the training dataset The average of the samples is taken. It is the training dataset, containing samples. , It is task input, It generates text. ReflectionToken is used to represent the relevance and accuracy of a paragraph. It is a logarithmic probability, used to transform the likelihood in product form into a summation, simplifying optimization and alleviating the gradient vanishing problem.
[0087] In practical applications, the above steps can be directly integrated into the KG-guided Evidence Relevance Calibration (KG-ERC) module. After integration, the module's functions can be used to quickly complete the dual-dimensional screening of semantic relevance and KG fact matching.
[0088] S3. Integrate the reference documents and the core fact set in the dedicated fact base into structured prompt words, input the structured prompt words into a large language model, use the large language model to output initial text from the dedicated fact base, and perform posterior validation and error correction on the initial text to obtain the final text that conforms to the strong fact constraints of the mining field, specifically including:
[0089] S31: Construct structured prompts, building prompts according to the instruction-document-fact structure, specifically including:
[0090] The command to generate the text is: “Write a maintenance guide for the WJ-2B underground internal combustion loader. The following core facts must be strictly followed, and there must be no parameter deviations or conflicting content.” In this embodiment, the command is the text generation command corresponding to the user query command.
[0091] Reference document excerpt: Extract the core paragraphs related to maintenance from the Top-5 documents, such as the 250-hour maintenance operation steps and hydraulic oil filling specifications;
[0092] List of core facts: List all the core facts in S1 regarding the maintenance of the WJ-2B underground internal combustion loader, such as "replace the engine oil every 250 hours of operation, and replace the oil filter and diesel filter at the same time", etc. In this example, there are X items of all core facts.
[0093] S32: Generate initial text: Input structured prompts into a large language model (such as GPT-4) and output "WJ-2B Underground Internal Combustion Shovel Maintenance Guide (Initial Version)", which includes maintenance cycle, oil selection, safe operation and other content.
[0094] S33: Perform posterior validation and error correction on the initial text to obtain the final text that conforms to the strong factual constraints of the mining field, specifically including:
[0095] Calculate the content relevance score (eval_score): Call the relevance assessment model in the mining field to extract the 512-dimensional semantic vector of the initial text and user needs, and obtain the basic score (accounting for 60%) through cosine similarity; count the number of times the initial text covers the core keywords of the reference document (such as "250-hour maintenance" and "oil filter filling"), calculate the keyword coverage rate (accounting for 40%), and obtain the eval_score by weighting.
[0096] Calculate the coverage of core facts: Based on X core facts, check whether the initial text covers key information one by one. If it is not explicitly stated that "air filter needs to be cleaned every 50 hours", it is determined that the fact is not covered. In this example, the example covered fact is Y. The coverage can be obtained by Y / X.
[0097] Calculate the average text similarity score (avg_sim): Compare the factual statements in the initial text with the core facts in the KG (Knowledge Base) sentence by sentence. Use semantic similarity to calculate the semantic similarity between the factual statements in the initial text and the core facts in the KG. For example, the initial text "Hydraulic oil uses Great Wall Zhuoli 46# anti-wear hydraulic oil, which is filtered by an oil filter during filling" has a similarity score with the KG facts. The average similarity scores of all the segments are used to obtain avg_sim.
[0098] Overall Score and Result Determination: The overall score is calculated according to the formula:
[0099] ;
[0100] in , and These are all hyperparameters. =0.3 (content relevance weight), ω=0.4 (fact coverage weight, prioritizing the inclusion of core facts), γ=0.3 (fact consistency weight). The preset comprehensive score threshold is 0.7. If the final score is greater than 0.7, the missing fact "air filter 50-hour cleaning" in the initial text can be added, and the complete "WJ-2B Underground Internal Combustion Shovel Loader Maintenance Guide (Final Version)" will be output as the final text. If the final score is less than 0.7, the X core facts in S1 will be directly output, with the reason for the rollback noted, such as "fact coverage is less than 40%, parameter deviation exists."
[0101] In practical applications, the above steps can be directly integrated into a KG-FCG (KG-anchored Fact Consistency Generation) module. After integration, the module's functions can be used to quickly complete the closed-loop constraint of structured keyword injection-guided generation and post-generation verification and error correction.
[0102] This invention, in its preferred embodiment, addresses potential issues in text generation within the mining sector, such as factual bias noise, non-standard information noise, and retrieval redundancy noise. It constructs a dual-dimensional "semantic + factual" filtering mechanism to effectively reduce noise affecting generation accuracy in the initial retrieval information, resulting in a denoised set of authoritative evidence. This significantly improves the model's robustness to non-core, non-standard information in the mining sector. This invention utilizes a comprehensive set of authoritative data, including mining industry standards, equipment technical manuals, and geological exploration reports, as supervisory signals. Through a "text crawling-entity extraction-relationship construction" process, it constructs a domain-configurable knowledge graph (KG). Essentially, this is a "structured clustering" of core facts in the mining sector: dispersed facts such as equipment parameters, geological data, and safety regulations are clustered along the "entity-relationship" dimension into specific fact sets related to equipment operation and maintenance, geological risks, and safe operations. This explicit fact grouping better adapts to different scenarios with strong factual constraints in mining, providing accurate factual benchmarks for subsequent generation. This invention improves the generation logic of traditional Retrieval Enhanced Generation (RAG). By constructing a closed-loop generation architecture of "structured cue word guidance + posterior validation and error correction," it optimizes the factual constraint parameters and error correction rules of the generation model, more accurately capturing the factual correlation logic in the mining field. This ensures that the generated text conforms to industry standards and provides practical guidance. It combines the structured fact set constructed by KG with the KG-guided evidence relevance calibration (KG-ERC) module to filter authoritative evidence for effective document screening, such as... Figure 3 As shown, this invention introduces a fact-aware verification and error correction mechanism. It achieves accurate generation and error correction through a KG-anchored fact consistency generation (KG-FCG) module, with KG injection guiding text generation, such as... Figure 4As shown, by comparing the differences between the initial text and the core facts of KG, problems such as missing facts, parameter deviations, and ambiguous expressions are identified. The generated text is configured with a "fact checker" to further improve the adaptability to the strong factual constraints required by the mine and avoid "fact illusions" and invalid information.
[0103] This application also provides a text generation system for the mining industry that requires strong factual constraints, including a processor and a memory;
[0104] Memory, used to store computer programs;
[0105] When a processor executes a program stored in memory, it implements any of the steps described in the text generation method for the mining sector that addresses strong factual constraints.
[0106] The aforementioned text generation system for the mining sector with strong factual constraints can implement various embodiments of the aforementioned text generation method for the mining sector with strong factual constraints, and can achieve the same beneficial effects. Further details are omitted here.
[0107] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A text generation method for the mining industry with strong factual constraints, characterized in that, include: S1. Construct a knowledge graph for the mining field, define core entities and core relationships between entities in the knowledge graph, construct a core fact set based on the core entities and core relationships between entities, and establish a dedicated fact base based on the core fact set. S2. Obtain candidate search documents corresponding to the user's query command, perform named entity recognition on the candidate search documents to obtain key entity information of the documents, calculate the matching degree between the key entity information of the documents and the exclusive fact base, and filter the top-k documents from the candidate search documents based on the matching degree. Filter the top-k documents with the highest matching degree based on a preset selection number as reference documents, where k is the preset selection number. S3. Integrate the reference documents and the core fact set in the dedicated fact base into structured prompt words, input the structured prompt words into the large language model, use the large language model to output the initial text from the dedicated fact base, and perform posterior verification and error correction on the initial text to obtain the final text that conforms to the strong fact constraints in the mining field. In S2, the matching degree between the key entity information of the document and the dedicated fact base is calculated, and Top-k documents are selected from the candidate search documents based on the matching degree, including: Traverse the core fact set in the dedicated fact base, input the document key entity information and the core fact set into the semantic matching degree model, set a matching degree threshold, filter the fact documents in the core fact set with a matching degree lower than the matching degree threshold, and obtain candidate search documents and matching degree scores between the candidate search documents and the document key entity information; The candidate retrieval documents and key entity information of the documents are input into the semantic relevance model to obtain the semantic relevance score between the candidate retrieval documents and key entity information of the documents. Based on the matching score and semantic relevance score, a weighted fusion algorithm is used to calculate the final score between the candidate search documents and the key entity information of the documents, and the Top-k documents are selected according to the final score. The weighted fusion algorithm calculates the following relationship: ; in, , These are hyperparameters used in the final score calculation. To evaluate the semantic relevance score output by the model, A score is given to the degree to which the document matches the core facts. This is the final score; Among them, the Top-k documents are candidate search documents ranked from high to low, and k is the preset number of selections; The semantic relevance model is trained based on maximizing the reflective token, with the training objective being to maximize the conditional likelihood of the reflective token. The training formula is as follows: ; in, It is a semantic relevance model. It is the expectation operator, applied to the training dataset. The average of the samples is taken. It is the training dataset, containing samples. , It is task input, It generates text. ReflectionToken is used to represent the relevance and accuracy of a paragraph. It is the logarithmic probability. This is the expected value.
2. The text generation method for the mining sector with strong factual constraints as described in claim 1, characterized in that, In S1, the core entities in the mining field include: mining equipment, geological structure, safety regulations, and work processes. The core relationships between these entities include: mining equipment - operation and maintenance parameters, geological structure - risk level, safety regulations - work requirements, and work processes - time nodes.
3. The text generation method for the mining sector with strong factual constraints as described in claim 1, characterized in that, In S1, the construction of a core fact set based on the core entities in the mining field and the core relationships between the entities includes: Based on the core entities in the mining field and the core relationships between them, the content of mining industry standard texts is integrated to obtain a set of core facts.
4. The text generation method for the mining sector with strong factual constraints as described in claim 1, characterized in that, In S3, the integration of the reference document with the core fact set in the dedicated fact base into structured prompt words includes: The text generation instruction is determined based on the user's query instruction. Document fragments are extracted from the reference document based on the text generation instruction. The corresponding core facts are determined in the dedicated fact base based on the document fragments, and a structured prompt word of instruction-document-fact is constructed.
5. The text generation method for the mining sector with strong factual constraints according to claim 1, characterized in that, In S3, the initial text undergoes posterior verification and error correction to obtain the final text that conforms to the strong factual constraints of the mining field, including: The relevance assessment model is invoked to evaluate the initial text, and the content relevance score between the initial text and the structured prompt words is obtained; The coverage ratio of the initial text to the core facts in the proprietary fact base is determined by attention calibration. The average text similarity between the initial text and the core facts in the dedicated fact base is calculated by comparing the main clauses. The text quality of the initial text is quantified using a comprehensive scoring formula to obtain a text score. The comprehensive scoring formula satisfies the following relationship: ; in, To score content relevance, The coverage ratio of core facts, This represents the average text similarity between the initial text and the core facts in the dedicated fact base. , and These are all hyperparameters used in the calculation of the overall score. Score the text; The final text, which conforms to the strong factual constraints of the mining field, is obtained based on the text score.
6. The text generation method for the mining sector with strong factual constraints according to claim 5, characterized in that, Based on the text score, the final text conforming to strong factual constraints in the mining field is obtained, including: A preset overall score threshold is set, and the text scores are compared with the overall score threshold; when When the value is below a preset threshold, the initial text will be rolled back to output the core facts corresponding to the dedicated fact base, and the reason for the rollback will be marked. when When the value exceeds the threshold, the core facts missing in the initial text are supplemented based on the structure of the structured prompt words, and the complete text is output as the final text.
7. The text generation method for the mining sector with strong factual constraints as described in claim 5, characterized in that, The initial text is evaluated using a relevance assessment model, including: The semantic vectors of the initial text and user needs are extracted by a relevance assessment model, and the basic score of the initial text is determined by cosine similarity. The coverage of key entity information in the initial text is counted, and the keyword coverage rate of key entity information in the initial text is determined based on the coverage. The content relevance score is obtained by weighting the basic score and the keyword coverage rate.
8. A text generation system for mining applications with strong factual constraints, characterized in that, Including processor and memory; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-7.
Citation Information
Patent Citations
Underground pipe gallery operation and maintenance scheme intelligent generation system and method
CN119961458A
Diversity-enhanced text retrieval-augmented generation method and system
WO2025245969A1