Method and system for constructing structured knowledge forest for unstructured text data
By fine-tuning the parameters of the large language model LLAMA3 and using thought chain reasoning, a structured knowledge forest was constructed, solving the problems of dependence on manual annotation and cross-disciplinary generalization, and realizing automated parsing and personalized knowledge management of textbooks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies rely on manual annotation when building structured knowledge forests, which is inefficient and costly, lacks cross-disciplinary generalization ability, and is difficult to identify implicit learning relationships.
We employ a dual LoRA architecture to fine-tune the parameters of the large language model LLAMA3, construct topic extraction and facet extraction models, combine thought chain reasoning and pseudo-label adaptation to generate topic facet trees and identify the learning sequence relationship, and support visualization and interactive modification.
It enables automated parsing and construction of multidisciplinary textbook documents, reduces annotation cycle, improves topic extraction accuracy and facet extraction accuracy, identifies implicit learning relationships, and supports personalized knowledge management.
Smart Images

Figure CN121786037A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically relating to a method and system for constructing a structured knowledge forest from unstructured text data. Background Technology
[0002] With the acceleration of digitalization in education, unstructured text data (such as textbooks and technical documents) is experiencing explosive growth. While these resources contain systematic knowledge, the content is mostly in the form of continuous text, lacking explicit structured representation, making it difficult for learners to intuitively grasp the hierarchical relationships and learning paths between knowledge points. Knowledge forests, as a novel knowledge representation framework, simulate the hierarchical cognitive pattern of the human brain through a topic-faceted tree structure and the sequential relationships between topics, effectively supporting navigable learning and intelligent question answering. However, existing knowledge forest construction methods heavily rely on manual annotation; for example, the annotation cycle for a single textbook often exceeds 10 hours, resulting in low efficiency and high costs.
[0003] In recent years, large language models (such as GPT-4 and LLAMA3) have demonstrated powerful text understanding and structured generation capabilities, providing a technical path for the automated construction of knowledge forests. However, existing methods still have the following problems: Disciplinary heterogeneity challenge: The themes and facets of expression differ significantly across disciplines (such as mathematics, computer science, and history), resulting in insufficient generalization ability of the model when extracting from different disciplines.
[0004] Implicit reasoning dilemma: The learning sequence relationship between topics can be either explicit or implicit. Implicit relationships lack direct linguistic markers and require deep reasoning through subject-specific logic and cognitive dependence, which existing methods struggle to effectively identify.
[0005] For example, the paper "Wei Z, Su J, Wang Y, et al. A novel cascade binary tagging framework for relational triple extraction [J]. arXiv preprint arXiv:190903227, 2019." addresses the error accumulation problem in the traditional pipeline method of performing Named Entity Recognition (NER) first and then Relation Classification (RC). It proposes the CasRel stacked pointer network model, which achieves joint extraction of entities and relations by sharing parameters. While it achieves joint extraction of entities and relations, it focuses on general domains and performs poorly in the education field. Another example is the paper "Liu J, Jiang L, Wu Z, et al. Mining learning-dependency between knowledgeunits from text [J]. The VLDB Journal, 2011, 20: 335-45." which, based on the asymmetric distribution of terms and the locality of dependencies, uses the SVM algorithm to fuse term frequency, distance, and semantic features, effectively identifying learning dependencies in text. However, due to its reliance on manual feature engineering, it cannot handle implicit relations. Summary of the Invention
[0006] The purpose of this invention is to address the problems in the prior art by providing a method and system for constructing structured knowledge forests from unstructured text data, reducing reliance on manual intervention, enhancing interdisciplinary generalization capabilities, and facilitating the identification of implicit learning relationships.
[0007] To achieve the above objectives, the present invention provides the following technical solution: Firstly, a method for constructing a structured knowledge forest from unstructured text data is provided, including: Construct a topic extraction instruction dataset and a faceted extraction instruction dataset; Based on the topic extraction instruction dataset and the facet extraction instruction dataset, a dual LoRA architecture is used to fine-tune the parameters of the selected base model to construct the topic extraction model and the facet extraction model. The input unstructured text data is parsed, and candidate topic sets and candidate facet sets are generated using the constructed topic extraction model and facet extraction model, respectively. Perform topic facet validation on the candidate topic set and candidate facet set, and generate a topic facet tree; Based on the generated topic faceted tree, the learning sequence relationship is extracted according to the thought chain to obtain a structured knowledge forest.
[0008] As a preferred approach, in the steps of constructing the topic extraction instruction dataset and the faceted extraction instruction dataset, the topic extraction instruction format is: "Identify the core knowledge concepts in the following text," with the input being a text paragraph and the output being a topic; the faceted extraction instruction format is: "Analyze the descriptive dimensions of [topic] in this paragraph," with the input being a text paragraph and a topic, and the output being faceteds; during the construction process, a placeholder replacement strategy is used to replace some topics with [topic], forcing the model to focus on the text structure; a negative sample generation strategy is introduced, using cross-disciplinary terminology replacement and faceted replacement to control the ratio of positive to negative samples.
[0009] As a preferred embodiment, in the step of constructing the topic extraction model and the facet extraction model based on the topic extraction instruction dataset and the facet extraction instruction dataset, the base model is selected as LLAMA3_7B. After parameter fine-tuning using the dual LoRA architecture, the topic extraction model LLAMA3_topic and the facet extraction model LLAMA3_facet are constructed. For the topic extraction model, the structural adapter S-LoRA injects the attention query matrix with a rank of 8 to enhance structural pattern recognition; the semantic adapter M-LoRA injects the intermediate layer of the feedforward neural network FFN with a rank of 4 to maintain semantic understanding capability; the loss function is negative log-likelihood loss, and the learning rate is set to 0.01. For the facet extraction model, the S-LoRA rank is set to 6, and the M-LoRA rank is set to 6 to balance structural and semantic attention.
[0010] As a preferred embodiment, in the step of parsing the input unstructured text data, for unstructured text documents, a document information extraction tool of the corresponding format is used for parsing to extract the table of contents and main text content, which are then divided into paragraphs and labeled with page numbers; for scanned documents, an OCR tool is used to extract the text; and non-text information is converted into images and associated with the most recent text paragraph.
[0011] As a preferred approach, in the step of generating candidate topic sets and candidate facet sets by utilizing the constructed topic extraction model and facet extraction model respectively, the parsed text paragraphs are input one by one into the topic extraction model LLAMA3_topic for candidate topic extraction, with the prompt being: "Identify the core knowledge concepts in the following text". The model outputs the topic corresponding to each paragraph, generating a candidate topic set. The parsed text paragraphs and their candidate topics are input into the facet extraction model LLAMA3_facet, with the prompt: "Analyze the descriptive dimension of [topic] in this paragraph". The model outputs the facets of each topic-paragraph pair, generating a set of candidate facets.
[0012] As a preferred approach, the step of verifying the candidate topic set and candidate facet set to generate a topic facet tree involves deleting topics without "defined" facets to ensure that topics are clearly defined in unstructured text data; filtering similar topic pairs through string fuzzy matching and keyword overlap detection, inputting them into a large language model to determine whether they are the same concept, with the prompt "Combining the relevant content of two knowledge concepts, determine whether [Topic A] and [Topic B] are the same knowledge concept"; and merging facets with the same topic to obtain the topic facet tree.
[0013] As a preferred approach, the steps of extracting learning sequence relationships based on the generated topic faceted tree and thought chain to obtain a structured knowledge forest include: locating the definition sentence of each topic for context construction; calculating semantic similarity using Sentence-BERT; selecting explanatory text based on semantic similarity; and recording the topic occurrence position and co-occurrence frequency matrix; constructing an explicit relation prompt word set for pseudo-label adaptation; matching prompt words from co-occurring paragraphs to generate pseudo-labels as context examples; and performing explicit relation recognition for co-occurring topic pairs, inputting the pseudo-labels and co-occurring content into a large language model for context learning. The process involves determining relationships. For non-co-occurring topic pairs, implicit relationship identification is used to reason through thought chains. Cognitive dependencies and subject-specific logical dependencies are generated by inputting the topic context. The prompt for cognitive dependencies is "Based on the above knowledge text, list the core cognitive abilities required to understand <topic>", and the prompt for subject-specific logical dependencies is "Based on the above knowledge text, list the type knowledge terms required to understand <topic>". The learning sequence is determined by comprehensively considering the dependency content, and causal verification is performed to ensure the correctness of the relationships. A directed topic graph is constructed for graph structure testing, and cyclic structures are detected. If a cycle exists, the relationships in the cycle are input into the large language model for correction.
[0014] As a preferred approach, it also includes steps to visualize and modify the constructed structured knowledge forest, develop and design the web front-end based on the Vue.js framework and Element-UI component library, and develop and design the web back-end using the Flask framework and MySQL database; Based on user-uploaded unstructured text documents, a structured knowledge forest is constructed, and the topics, facets, fragmented knowledge, and learning relationships are visualized. At the same time, manual addition, deletion, and modification of topics, facets, fragmented knowledge, and learning relationships are supported.
[0015] Secondly, a system for constructing a structured knowledge forest from unstructured text data is provided, including: The instruction dataset building module is used to build the topic extraction instruction dataset and the faceted extraction instruction dataset; The extraction model building module is used to fine-tune the parameters of the selected base model based on the topic extraction instruction dataset and the faceted extraction instruction dataset, and to build the topic extraction model and the faceted extraction model using a dual LoRA architecture. The candidate set generation module is used to parse the input unstructured text data and generate candidate topic sets and candidate facet sets using the constructed topic extraction model and facet extraction model, respectively. The verification module is used to verify the candidate topic set and candidate facet set for topic facets and generate a topic facet tree. The module for extracting learning sequence relationships is used to extract learning sequence relationships based on the generated topic faceted tree and the thought chain, resulting in a structured knowledge forest.
[0016] Thirdly, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, the at least one instruction being executed by a processor in an electronic device to implement the method for constructing a structured knowledge forest from unstructured text data.
[0017] Compared with the prior art, the present invention has at least the following beneficial effects: This invention constructs multidisciplinary topic extraction and facet extraction instruction datasets from Wikipedia, existing knowledge forest data, and expert annotations. Through fine-tuning of the instruction data and reasoning based on thought chains, it solves the challenges of identifying subject heterogeneity and implicit relationships. This invention's method for constructing structured knowledge forests from unstructured text data is particularly suitable for textbooks, automatically transforming textbook documents into structured knowledge forests. Compared to traditional methods that require over 10 hours of annotation time for a single textbook, this invention can complete the parsing, construction, and visualization of textbooks within minutes to an hour, significantly reducing engineering costs. Employing a dual LoRA architecture to fine-tune the parameters of the selected base model, it constructs topic extraction and facet extraction models. The constructed models perform excellently on textbook documents across multiple disciplines (such as mathematics, biology, and economics), achieving high-quality document parsing. The average accuracy of topic extraction is improved by 10%, and the average accuracy of facet extraction is improved by 3%. The F1 score is 10%-20% higher than LLAMA3+Langchain, outperforming existing large language model methods. This invention presents a method for constructing structured knowledge forests from unstructured text data. This method accurately extracts topics and facets even in unknown domains, extracts learning sequence relationships based on thought chains, and simulates the human cognitive process, effectively identifying implicit learning relationships. Furthermore, it can utilize the characteristics of textbooks to generate prompt examples, enabling the model to quickly adapt to new domains and reducing reliance on labeled data.
[0018] Furthermore, the structured knowledge forest constructed by this invention supports visual browsing and interactive modification. The web front-end is developed using the Vue.js framework and Element-UI component library, while the web back-end is developed using the Flask framework and MySQL database. Based on user-uploaded unstructured text documents, a structured knowledge forest is constructed, and the visualization of topics, facets, fragmented knowledge, and learning relationships is achieved. Users can manually add, delete, and modify automatically generated topics, facets, fragmented knowledge, and learning relationships, ensuring the accuracy of knowledge and meeting personalized needs, thus realizing intelligent knowledge management through human-computer collaboration. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating the generation of a topic facet tree in this embodiment of the invention; Figure 2 This invention's embodiments are based on a flowchart of the learning sequence relationship extracted from the mind chain; Figure 3 A schematic diagram illustrating the relationship between course topics and learning sequence in an embodiment of the present invention; Figure 4 Schematic diagram of topic extraction in an embodiment of the present invention; Figure 5 A schematic diagram of facet extraction according to an embodiment of the present invention; Figure 6 Schematic diagram of explicit relationship identification in an embodiment of the present invention; Figure 7 Existing LLAMA3+langchain model architecture diagram; Figure 8 A schematic diagram of the main interface for visual browsing of a structured knowledge forest according to an embodiment of the present invention; Figure 9 A schematic diagram of the automatic course construction process according to an embodiment of the present invention; Figure 10 A schematic diagram illustrating the completion of course construction according to an embodiment of the present invention; Figure 11 A schematic diagram illustrating the relationship between course topics and learning sequence in an embodiment of the present invention; Figure 12 This invention provides a schematic diagram of the topic-facet-fragment knowledge within a course. Figure 13 A schematic diagram illustrating the editing and modification of knowledge fragments in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, those skilled in the art can obtain other embodiments without creative effort.
[0022] Please see Figure 1 and Figure 2 This invention proposes a method for constructing a structured knowledge forest from unstructured text data, including textbooks, technical documents, etc., and mainly includes the following steps: S1. Construct the topic extraction instruction dataset and the faceted extraction instruction dataset; S2. Based on the topic extraction instruction dataset and the facet extraction instruction dataset, a dual LoRA architecture is used to fine-tune the parameters of the selected base model to construct the topic extraction model and the facet extraction model. S3. Parse the input unstructured text data, and generate candidate topic sets and candidate facet sets using the constructed topic extraction model and facet extraction model respectively. S4. Perform topic facet verification on the candidate topic set and candidate facet set, and generate a topic facet tree; S5. Based on the generated topic faceted tree, extract the learning sequence relationship based on the thinking chain to obtain a structured knowledge forest.
[0023] In one possible implementation, the topic faceting tree construction based on instruction data fine-tuning in this embodiment of the invention refers to: Please see Figure 3 First, a multidisciplinary topic extraction and facet extraction instruction dataset is constructed, and placeholder replacement and negative sample generation strategies are employed to enhance the model's generalization ability. Then, the LLAMA3 model is fine-tuned using a dual LoRA architecture to obtain the topic extraction model LLAMA3_topic and the facet extraction model LLAMA3_facet. Finally, after parsing the input document, the topic and facet extraction models are called sequentially, and a validation module merges semantically similar topics and removes irrelevant topics.
[0024] In one possible implementation, step S1 of this embodiment of the invention constructs a multidisciplinary topic extraction and facet extraction instruction dataset from Wikipedia, existing knowledge forest data, and expert annotations, which is divided into topic extraction and facet extraction, such as... Figure 4 and Figure 5As shown. The topic extraction instruction format is: "Identify the core knowledge concepts in the following text," with the input being a text paragraph and the output being a topic; the facet extraction instruction format is: "Analyze the descriptive dimensions of [topic] in this paragraph," with the input being a text paragraph and a topic, and the output being facets (such as "definition," "feature," etc.). During the construction process, a placeholder replacement strategy is used to replace some topics with [topic], forcing the model to focus on the text structure; a negative sample generation strategy is introduced, using cross-disciplinary terminology replacement (such as replacing "queue" with "mitochondria") and facet replacement (such as replacing "definition" with "application") to control the positive-to-negative sample ratio, which is 5:1. The dataset covers 100 courses including computer science, mathematics, physics, and chemistry.
[0025] In one possible implementation, the base model in step S2 of this embodiment is LLAMA3_7B. After parameter fine-tuning using a dual LoRA architecture, a topic extraction model LLAMA3_topic and a facet extraction model LLAMA3_facet are constructed. For the topic extraction model, the S-LoRA structural adapter injects an attention query matrix with a rank of 8 to enhance structural pattern recognition; the M-LoRA semantic adapter injects an intermediate layer of the feedforward neural network FFN with a rank of 4 to maintain semantic understanding; the loss function is negative log-likelihood loss, and the learning rate is set to 0.01. For the facet extraction model, the S-LoRA rank is set to 6, and the M-LoRA rank is set to 6 to balance structural and semantic attention. The training environment uses two NVIDIA GeForce RTX 3090 graphics cards, Python 3.9.10, and PyTorch 2.3.1.
[0026] In one possible implementation, when parsing the input unstructured text data in step S3 of this embodiment of the invention, for unstructured text documents, a document information extraction tool of the corresponding format is used for parsing (for input textbook PDF documents, pdfminer or PyMuPDF tools are used for parsing), extracting the table of contents and main text content, dividing them by paragraph and marking page numbers; for scanned documents, an OCR tool (such as Tesseract) is used to extract the text; non-text information (such as images, tables, etc.) is converted into images and associated with the most recent text paragraph.
[0027] Furthermore, in step S3 of this embodiment of the invention, when generating candidate topic sets and candidate facet sets using the constructed topic extraction model and facet extraction model, the parsed text paragraphs are input one by one into the topic extraction model LLAMA3_topic for candidate topic extraction, with the prompt message being: "Identify the core knowledge concepts in the following text". The model outputs the topic corresponding to each paragraph, generating a candidate topic set; the parsed text paragraphs and their candidate topics are input into the facet extraction model LLAMA3_facet, with the prompt message being: "Analyze the descriptive dimension of [topic] in this paragraph". The model outputs the facets of each topic-paragraph pair, generating a candidate facet set.
[0028] In one possible implementation, the topic facet verification in step S4 of this embodiment refers to deleting topics without "defined" facets to ensure that topics are clearly defined in unstructured text data; filtering similar topic pairs through string fuzzy matching and keyword overlap detection, inputting them into the LLAMA3 model to determine whether they are the same concept, with the prompt "Combining the relevant content of two knowledge concepts, determine whether [Topic A] and [Topic B] are the same knowledge concept"; and merging facets of the same topic to obtain a topic facet tree.
[0029] In one possible implementation, step S5 of this embodiment of the invention locates the definition sentence of each topic (the sentence that appears for the first time and contains patterns such as "defined as", "is") for context construction, uses Sentence-BERT to calculate semantic similarity, selects the Top-3 explanatory texts based on semantic similarity, and records the topic's occurrence position (chapter, page number) and co-occurrence frequency matrix; constructs a set of explicit relational cue words (such as "prerequisite", "foundation", "mastery", etc.) for pseudo-label adaptation, matches cue words from co-occurring paragraphs, and generates pseudo-labels as context examples; for co-occurring topic pairs, performs explicit relational identification, inputs the pseudo-labels and co-occurrence content into the LLAMA3 model, and... Contextual learning is used to determine relationships. For non-co-occurring topic pairs, implicit relationship recognition is used to reason through thought chains. Cognitive dependencies and subject-specific logical dependencies are generated by inputting the topic context. The prompt for cognitive dependencies is "Based on the above knowledge text, list the 5 core cognitive abilities required to understand <topic>", and the prompt for subject-specific logical dependencies is "Based on the above knowledge text, list the 5 types of knowledge terms required to understand <topic>". The learning sequence is determined by comprehensively considering the dependency content, and causal verification (hypothesis and counterfactual reasoning) is performed to ensure the correctness of the relationships. A directed topic graph is constructed to perform graph structure testing and detect cyclic structures. If a cycle exists, the relationships in the cycle are input into the large language model for correction.
[0030] In one possible implementation, the present invention further includes step S6, visualizing and modifying the constructed structured knowledge forest. Specifically, this includes: developing and designing the web front-end based on the Vue.js framework and the Element-UI component library, and developing and designing the web back-end using the Flask framework and a MySQL database. The system front-end is developed based on the Vue.js framework, fully utilizing its reactive data binding and component-based advantages to achieve efficient view layer construction and a good user interaction experience. Simultaneously, the Element-UI component library is introduced to quickly build a user interface that conforms to enterprise-level design specifications and has a unified style, ensuring functional completeness and visual friendliness. To handle front-end and back-end data communication, the front-end integrates the Axios library, utilizing its Promise-based asynchronous request capabilities and interceptor mechanism to simplify the API call process and enhance the configurability of error handling and request management. The back-end technology stack is entirely based on the Python ecosystem. Flask, as a lightweight and flexible web framework, undertakes the core API interface development tasks and is combined with the Gunicorn server to achieve high-performance deployment. For data persistence, SQLAlchemy is used as the ORM tool to efficiently manage interactions with the MySQL database, ensuring the security and convenience of structured data operations. To handle I / O-intensive tasks such as large model calls, the backend utilizes asynchronous libraries like aiohttp to improve concurrency performance and response speed. Furthermore, the system integrates PyMuPDF for PDF document parsing and tools like Langchain to support operations on the vector database (ChromaDB) and the development of large model applications, forming a complete, efficient, and maintainable backend technology solution. The structured knowledge forest constructed by this invention supports visual browsing and interactive modification. Based on user-uploaded unstructured text documents, a structured knowledge forest is built, and the visualization of topics, facets, fragmented knowledge, and learning relationships is achieved. Simultaneously, manual addition, deletion, and modification of topics, facets, fragmented knowledge, and learning relationships are supported.
[0031] This invention addresses the challenges of identifying subject-specific heterogeneity and implicit relationships through instruction data fine-tuning and thought chain reasoning. It employs dual LoRA fine-tuning: S-LoRA enhances the model's sensitivity to text structure (such as definitional sentences), while M-LoRA maintains semantic understanding, enabling the model to accurately extract topics and facets even in unknown domains. The thought chain mechanism simulates the human cognitive process, uncovering subject-specific logic and cognitive dependencies through multi-step reasoning, effectively identifying implicit learning relationships. Combined with pseudo-label adaptation, it utilizes textbook features to generate prompt examples, allowing the model to quickly adapt to new domains and reducing reliance on labeled data.
[0032] The algorithm for constructing the topic faceting tree according to the embodiments of the present invention is shown in the following table:
[0033] The effects of the method in the embodiments of the present invention will be experimentally illustrated below with specific examples.
[0034] The experiment includes two fine-tuned models, LLAMA3_topic and LLAMA3_facet, which take text fragments as input. Together, they form a topic facet tree construction model that takes textbook documents as input and outputs topic facet trees. To test model performance, this embodiment constructs topic facet datasets in several domains based on existing knowledge forest data and Wikipedia data. Several e-textbooks from different disciplines are selected, and their topic facet trees are manually labeled. The subject areas involved in the datasets are different and do not appear in the instruction dataset, in order to test the model's cross-domain generalization ability.
[0035] The following table provides an example of a topic faceted dataset:
[0036] The following table provides an example of a textbook dataset:
[0037] In the LLAMA3_topic topic extraction model, the rank of the S-Lora adaptation matrix was set to 8, and the rank r_m of the M-Lora adaptation matrix was set to 4. In the facet extraction model, the rank r_s of the S-Lora adaptation matrix was set to 6, and the rank r_m of the M-Lora adaptation matrix was set to 6. This was done to focus more on the structural information of the text when extracting topics, and to strengthen the focus on semantic information when extracting facets under a topic. The fine-tuned learning rate was set to 0.01. Experiments were conducted on two NVIDIA-3090 graphics cards.
[0038] The following table shows the experimental system environment settings:
[0039] The overall model comparison experiment results are shown in the table below:
[0040] The results of the experiment comparing the accuracy of topic extraction models are shown in the table below:
[0041] The results of the faceted extraction model accuracy comparison experiment are shown in the table below:
[0042] The results of the above comparative experiments show that: 1) The overall model of the method of this invention outperforms existing large language model methods in all domain textbooks in the dataset. Furthermore, in the topic extraction and facet extraction subtasks, the LLAMA3_topic and LLAMA3_facet models of this invention also outperform current large language model methods, achieving the best results.
[0043] 2) The three open-source large language models—LLAMA3, GLM3, and Qwen2—showed similar performance in topic extraction, all performing poorly. This is because when extracting topics across different domains, these models rely on contextual cues from different domains and cannot accurately identify the knowledge topics contained in cross-domain texts. However, their accuracy improved when extracting facets from a given topic compared to topic extraction. This indicates that large language models are better at extracting attributes from known content, possibly because they possess an inherent understanding of these topics, which is brought into play after the topic is determined. These models performed similarly in the overall task of constructing topic facet trees, exhibiting low accuracy and good recall. This suggests that while large language models can identify most knowledge topics and facets in textbooks, they also extract a large number of incorrect topics and facets. Therefore, in practical applications, verifying and filtering the results generated by large language models is a crucial step.
[0044] 3) Deepseek, as the only method that uses an API call, demonstrates better topic extraction and facet extraction results than open-source large language models under the same context learning approach, and performs better in actual textbooks. This is likely because the large language model used in the Deepseek method has a larger number of parameters, exhibiting better natural language understanding and context learning capabilities. In contrast, the model of this invention uses fewer parameters (7B), yet outperforms the larger-parameter Deepseek_V1 model in topic extraction, facet extraction, and overall tasks, indicating that the model of this invention has stronger cross-domain topic extraction and facet extraction capabilities. In the topic extraction task, the accuracy of the LLAMA3_topic model of this invention is on average about 10% higher than that of the Deepseek_V1 model; in the facet extraction task, the accuracy of the LLAMA3_facet model of this invention is on average about 3% higher than that of the Deepseek_V1 model. This also demonstrates that large language models are better suited to handling facet extraction tasks under a specified topic. In the overall task, the F1 score of the LLAMA3_topic model of this invention is about 7% higher than that of the Deepseek_V1 model on average in textbooks for "Advanced Mathematics" and "Artificial Intelligence", and about 15% higher than that of the Deepseek_V1 model on average in textbooks for "Astronomy", "Macroeconomics" and "Molecular Biology", which shows that the model of this invention has strong cross-domain generalization.
[0045] Examples of explicit learning order relationships in embodiments of the present invention are shown in the table below:
[0046] The statistical analysis of the learning order of this invention in several textbooks is shown in the table below:
[0047] The process of explicit relation recognition in this embodiment of the invention is as follows: Figure 6 As shown.
[0048] As shown in the table below, in the experiment of extracting learning sequence relationships, this embodiment of the invention constructed a dataset of learning sequence relationships between topics in six subject areas: "Data Structures," "Artificial Intelligence," "Advanced Mathematics," "Molecular Biology," "Macroeconomics," and "Astrophysics." Within each subject area, some topics and the learning sequence relationships between them are labeled. These six datasets will be used to test the performance of the model designed in this paper.
[0049]
[0050] In the Learning Precedence Relationship Extraction Model (TRLM), the number of explanatory texts in the context building module is set to k=3, the number of cognitive bases generated is x=5, and the number of subject-specific logical dependencies generated is y=5. The experiment was conducted on two NVIDIA-3090 graphics cards.
[0051] The experimental system environment settings are shown in the table below:
[0052] In this embodiment, the base model of the TRLM model is LLAMA3_7B. The model can be viewed as adding pluggable policy modules to the base model; simply replacing the base model does not prevent the ability to extract learning sequence relationships. Furthermore, the model's input is the entire textbook document text. Since a large language model cannot directly accept the entire textbook document text as input, compared to the currently most commonly used knowledge base question answering architecture of LLAMA3+langchain, this method uses the textbook document text as an external knowledge base mounted on the large language model, enabling the extraction of learning sequence relationships between topics from the entire textbook document text. The existing LLAMA3+langchain model architecture is as follows: Figure 7 As shown. To adapt this method to the research task, this embodiment divides the textbook document into text blocks and embeds them into a vector space using text vectorization. Then, the input question is designed as "Determine whether there is a learning sequence relationship between [Topic A] and [Topic B]". The question is transformed into vector form using the same method. Then, the closest textbook text block vector is matched by vector similarity and used as the prompt content input to LLAMA3. Examples of learning sequence relationships are added to the input as contextual prompts for the model, allowing it to determine the learning sequence relationship between topics. The same graph structure verification strategy as the TRLM model is used.
[0053] The algorithm for extracting the learning sequence relationship in this invention is shown in the table below:
[0054] The results of the comparative experiment on learning relation extraction are shown in the table below:
[0055] The results of the comparative experiment show that: 1) The TRLM model proposed in this embodiment significantly outperforms the LLAMA3+Langchain model architecture in terms of accuracy, recall, and F1 score when extracting learning order relations in six textbook datasets. The F1 score is improved by 0%-20% compared to LLAMA3+Langchain. In textbooks with a high proportion of implicit relations, such as "Data Structures," "Artificial Intelligence," and "Advanced Mathematics," the TRLM model in this embodiment improves the F1 score by 20% compared to the LLAMA3+Langchain model. In the remaining textbooks, the F1 score is also improved by about 10%, indicating that the method of this invention can accurately identify explicit learning order relations and also effectively identify implicit learning order relations between topics.
[0056] 2) The recall rate in both methods is significantly higher than the precision rate. This may be because the large language model tends to assume that there is a learning sequence relationship between the two input knowledge topics. This also illustrates the importance of the verification strategies such as causal hypothesis and counterfactual reasoning in the model of this invention.
[0057] Experimental verification shows that the method of this invention, by constructing a topic faceted tree, achieves an average topic extraction accuracy of 65.2% and an average faceted extraction accuracy of 78.7% on datasets in molecular biology, macroeconomics, and astronomy. Compared to the DeepSeek-V1 model, the topic extraction accuracy is improved by 10%, and the faceted extraction accuracy by 3%. By learning the sequence relationship extraction, the F1 score on textbooks such as data structures and advanced mathematics reaches an average of 85.3%, which is 15%-20% higher than the LLAMA3+Langchain model method. Ablation experiments show that the pseudo-label adaptation module contributes about 5% to the improvement in F1 score, while cognition and subject-specific dependency generation each contribute about 4%. The method of this invention has been used to construct knowledge forests for multiple textbooks, reducing the construction time from 10 hours manually to less than 1 hour automatically.
[0058] This invention visualizes and modifies the constructed structured knowledge forest. The core design philosophy of the system lies in the separation of front-end and back-end and service decoupling, aiming to build a modern application that is highly cohesive, loosely coupled, easy to maintain, and scalable. The system completely delegates complex business logic to the back-end, while the front-end focuses on user interaction and data visualization. The two communicate through standardized API interfaces, achieving separation of responsibilities and improving development efficiency and system stability. In terms of back-end architecture, the system further adopts a microservice design approach. Previously tightly coupled functional modules such as document parsing, model invocation, and algorithm execution are broken down into independent lightweight service units. Each service unit has an independent lifecycle and communicates only through interfaces. This architecture significantly improves the system's deployment flexibility, fault tolerance, and the scalability of functional modules. For example, when an algorithm model needs to be upgraded or replaced, it will not affect the normal operation of other services. Furthermore, the system design embodies the concept of combining automation and operability. On the one hand, the system automatically constructs a knowledge forest from textbook PDFs by integrating a large language model (LLAMA3), which greatly improves the construction efficiency. On the other hand, the front end provides a complete knowledge forest visualization interface and supports users to add, delete, and modify automatically generated topics, facets, fragments, and relationships, ensuring the accuracy of knowledge and meeting personalized teaching needs, thus realizing intelligent knowledge management through human-computer collaboration.
[0059] This invention also proposes a system for constructing a structured knowledge forest from unstructured text data, comprising: The instruction dataset building module is used to build the topic extraction instruction dataset and the faceted extraction instruction dataset; The extraction model building module is used to fine-tune the parameters of the selected base model based on the topic extraction instruction dataset and the faceted extraction instruction dataset, and to build the topic extraction model and the faceted extraction model using a dual LoRA architecture. The candidate set generation module is used to parse the input unstructured text data and generate candidate topic sets and candidate facet sets using the constructed topic extraction model and facet extraction model, respectively. The verification module is used to verify the candidate topic set and candidate facet set for topic facets and generate a topic facet tree. The module for extracting learning sequence relationships is used to extract learning sequence relationships based on the generated topic faceted tree and the thought chain, resulting in a structured knowledge forest.
[0060] Please see Figure 8When using the knowledge forest construction system of this invention, first click the "Add Course" option on the main interface, then select "Automatic Construction (Automatically build knowledge forest by uploading files)". Next, enter the basic information such as the course name and upload the textbook document file in PDF format. Click the "OK" button to start the automatic construction of the knowledge forest using the algorithm. The course will then be in the automatic construction process, such as... Figure 9 As shown. After the course uses the algorithm to complete the knowledge forest construction, it will change from "Automatically building" to "Unpublished" and display the topics, relationships, facets, and number of fragments, such as... Figure 10 As shown. Clicking on the course name will take you to the course's knowledge forest, such as... Figure 11 As shown, the interface displays the learning sequence relationships between topics. The left side shows all topics in the course. Topics can be added using the "Add Topic" button, or by right-clicking a topic and selecting "Edit" or "Delete." You can also switch to a relational view to modify the learning sequence. The right side visualizes the learning sequence relationships between topics, retaining only adjacent relationships based on transitivity. Within the course's knowledge forest, you can also switch to a "faceted-fragment" perspective, such as... Figure 12 As shown, the left side displays the topic and its corresponding facets. You can add facets to a selected topic by clicking the "+Facet" button. The middle section visualizes the facets within a topic. The right side displays fragmented knowledge under the selected topic and facets. You can add fragments to a specified facet by clicking the "+Fragment" button, or browse or modify fragmented knowledge by clicking the text. Figure 13 As shown.
[0061] Another embodiment of the present invention provides an electronic device comprising: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the method for constructing a structured knowledge forest from unstructured text data.
[0062] Another embodiment of the present invention provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the method for constructing a structured knowledge forest from unstructured text data.
[0063] For example, the instructions stored in the memory can be divided into one or more modules / units. These modules / units are stored in a computer-readable storage medium and executed by the processor to complete the method of constructing a structured knowledge forest from unstructured text data according to the present invention. The one or more modules / units can be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program on the server.
[0064] The electronic device may be a smartphone, laptop, PDA, or cloud server, among other computing devices. It may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the electronic device may also include more or fewer components, or combinations of certain components, or different components; for example, it may also include input / output devices, network access devices, buses, etc.
[0065] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0066] The memory can be an internal storage unit of the server, such as a hard drive or RAM. It can also be an external storage device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or FlashCard. Furthermore, the memory can include both internal and external storage units. The memory is used to store computer-readable instructions and other programs and data required by the server. It can also be used to temporarily store data that has been output or will be output.
[0067] It should be noted that the information interaction and execution process between the above-mentioned module units are based on the same concept as the method embodiment. For details on their specific functions and technical effects, please refer to the method embodiment section. They will not be repeated here.
[0068] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0069] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0070] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0071] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for constructing a structured knowledge forest from unstructured text data, characterized in that, include: Construct a topic extraction instruction dataset and a faceted extraction instruction dataset; Based on the topic extraction instruction dataset and the facet extraction instruction dataset, a dual LoRA architecture is used to fine-tune the parameters of the selected base model to construct the topic extraction model and the facet extraction model. The input unstructured text data is parsed, and candidate topic sets and candidate facet sets are generated using the constructed topic extraction model and facet extraction model, respectively. Perform topic facet validation on the candidate topic set and candidate facet set, and generate a topic facet tree; Based on the generated topic faceted tree, the learning sequence relationship is extracted according to the thought chain to obtain a structured knowledge forest.
2. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, In the steps of constructing the topic extraction instruction dataset and the facet extraction instruction dataset, the topic extraction instruction format is: "Identify the core knowledge concepts in the following text", with the input being a text paragraph and the output being a topic; the facet extraction instruction format is: "Analyze the descriptive dimensions of [topic] in this paragraph", with the input being a text paragraph and a topic and the output being a facet; during the construction process, a placeholder replacement strategy is used to replace some topics with [topic], forcing the model to focus on the text structure; a negative sample generation strategy is introduced, using cross-disciplinary terminology replacement and facet replacement to control the ratio of positive to negative samples.
3. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, In the step of constructing the topic extraction model and the facet extraction model based on the topic extraction instruction dataset and the facet extraction instruction dataset, the base model is LLAMA3_7B. After parameter fine-tuning using the dual LoRA architecture, the topic extraction model LLAMA3_topic and the facet extraction model LLAMA3_facet are constructed. For the topic extraction model, the structural adapter S-LoRA injects the attention query matrix with a rank of 8 to enhance structural pattern recognition; the semantic adapter M-LoRA injects the intermediate layer of the feedforward neural network FFN with a rank of 4 to maintain semantic understanding; the loss function is negative log-likelihood loss, and the learning rate is set to 0.
01. For the facet extraction model, the S-LoRA rank is set to 6, and the M-LoRA rank is set to 6 to balance structural and semantic attention.
4. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, In the step of parsing the input unstructured text data, for unstructured text documents, a document information extraction tool of the corresponding format is used to parse them, extract the table of contents and main text content, divide them into paragraphs and mark page numbers; for scanned documents, an OCR tool is used to extract the text; non-text information is converted into images and associated with the most recent text paragraph.
5. The method for constructing a structured knowledge forest from unstructured text data according to claim 4, characterized in that, In the step of generating candidate topic sets and candidate facet sets by using the constructed topic extraction model and facet extraction model respectively, the parsed text paragraphs are input one by one into the topic extraction model LLAMA3_topic for candidate topic extraction. The prompt is: "Identify the core knowledge concepts in the following text". The model outputs the topic corresponding to each paragraph and generates a candidate topic set. The parsed text paragraphs and their candidate topics are input into the facet extraction model LLAMA3_facet, with the prompt: "Analyze the descriptive dimension of [topic] in this paragraph". The model outputs the facets of each topic-paragraph pair, generating a set of candidate facets.
6. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, In the step of verifying the candidate topic set and candidate facet set to generate a topic facet tree, the topic facet verification refers to deleting topics without "defined" facets to ensure that topics are clearly defined in unstructured text data; filtering similar topic pairs through string fuzzy matching and keyword overlap detection, inputting them into a large language model to determine whether they are the same concept, with the prompt "Combining the relevant content of two knowledge concepts, determine whether [Topic A] and [Topic B] are the same knowledge concept"; merging facets of the same topic to obtain the topic facet tree.
7. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, The steps for obtaining a structured knowledge forest by extracting the learning sequence relationship based on the generated topic faceted tree and the thought chain include: locating the definition sentence of each topic to construct the context; using Sentence-BERT to calculate semantic similarity; selecting explanatory text based on semantic similarity; and recording the topic's occurrence position and co-occurrence frequency matrix; constructing an explicit relation prompt word set for pseudo-label adaptation; matching prompt words from co-occurring paragraphs to generate pseudo-labels as context examples; and performing explicit relation recognition for co-occurring topic pairs, inputting the pseudo-labels and co-occurring content into a large language model, and judging the relationship through context learning. For non-co-occurring topic pairs, implicit relation recognition is used to reason through thought chains. Cognitive dependencies and subject-specific logical dependencies are generated by inputting the topic context. The prompt for cognitive dependencies is "Based on the above knowledge text, list the core cognitive abilities required to understand <topic>", and the prompt for subject-specific logical dependencies is "Based on the above knowledge text, list the type knowledge terms required to understand <topic>". The learning sequence is determined by comprehensively considering the dependency content, and causal verification is performed to ensure the correctness of the relationships. A directed topic graph is constructed to perform graph structure testing and detect cyclic structures. If a cycle exists, the relationships in the cycle are input into the large language model for correction.
8. The method for constructing a structured knowledge forest from unstructured text data according to claim 1, characterized in that, It also includes steps for visualizing and modifying the constructed structured knowledge forest, developing and designing the web front-end based on the Vue.js framework and Element-UI component library, and developing and designing the web back-end using the Flask framework and MySQL database; Based on user-uploaded unstructured text documents, a structured knowledge forest is constructed, and the topics, facets, fragmented knowledge, and learning relationships are visualized. At the same time, manual addition, deletion, and modification of topics, facets, fragmented knowledge, and learning relationships are supported.
9. A system for constructing a structured knowledge forest from unstructured text data, characterized in that, include: The instruction dataset building module is used to build the topic extraction instruction dataset and the faceted extraction instruction dataset; The extraction model building module is used to fine-tune the parameters of the selected base model based on the topic extraction instruction dataset and the faceted extraction instruction dataset, and to build the topic extraction model and the faceted extraction model using a dual LoRA architecture. The candidate set generation module is used to parse the input unstructured text data and generate candidate topic sets and candidate facet sets using the constructed topic extraction model and facet extraction model, respectively. The verification module is used to verify the candidate topic set and candidate facet set for topic facets and generate a topic facet tree. The module for extracting learning sequence relationships is used to extract learning sequence relationships based on the generated topic faceted tree and the thought chain, resulting in a structured knowledge forest.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, which is executed by a processor in an electronic device to implement the method for constructing a structured knowledge forest for unstructured text data as described in any one of claims 1 to 8.