Ship maintenance knowledge question answering method based on hierarchical problem sub-tree and metadata constraint

CN122452792BActive Publication Date: 2026-08-28NAVAL UNIV OF ENG PLA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610943808.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-29
Publication Date
2026-08-28
Estimated Expiration
2046-06-29

AI Technical Summary

Technical Problem

[0003]但是,这种基于RAG的船舶维修领域智能问答方法仍然存在以下缺陷:

Benefits of technology

(1)本发明提供的一种基于分层问题子树与元数据约束的船舶维修知识问答方法,通过对船舶维修相关的多源异构文档数据集进行预处理和语义切分,形成多个知识片段,提取每个知识片段的多个维度的元数据,构建根节点-父节点-子节点的分层问题子树;在用户问答时,先通过分层问题子树进行逐层匹配,完成故障层级的递进式定位,检索出至少一个最相关的知识片段;然后,基于该最相关的知识片段生成结构化维修方案,从而能够提高船舶维修知识问答方法的检索精准度;并且,通过检索过程与轮机专家诊断逻辑(即分层问题子树的构建逻辑)的深度融合,能够从根源上降低模型幻觉与合规性风险。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122452792B_ABST
    Figure CN122452792B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence natural language processing, and discloses a ship maintenance knowledge question answering method based on hierarchical problem sub-trees and metadata constraints, which comprises the following steps: acquiring a ship maintenance related multi-source heterogeneous document dataset, preprocessing and semantically dividing the multi-source heterogeneous document dataset, extracting metadata of multiple dimensions of each knowledge segment, taking the metadata of the multiple dimensions as attribute labels of the corresponding knowledge segment, and vectorizing and binding each knowledge segment and its attribute label; performing hierarchical clustering to construct a hierarchical problem sub-tree of a root node-parent node-sub node; receiving a user question, layer by layer matching metadata of at least one dimension in the question with nodes of the hierarchical problem sub-tree, and retrieving at least one most relevant knowledge segment; and fusing the question and the at least one most relevant knowledge segment to generate a structured maintenance scheme. The method can improve the retrieval accuracy of the ship maintenance knowledge question answering method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence and natural language processing technology, and more specifically, to a ship maintenance knowledge question answering method based on hierarchical question subtrees and metadata constraints. Background Technology

[0002] Currently, the mainstream technical solution for intelligent question answering in the field of ship maintenance is the Retrieval-augmented Generation (RAG) architecture based on a large language model. The core process consists of four stages: building a ship maintenance knowledge base, transforming user question vectors, searching for vector similarity across the entire database, and generating answers by fusing knowledge from a large model. Some advanced solutions combine knowledge graphs to achieve structured organization of ship fault knowledge, thereby improving the accuracy of question answering.

[0003] However, this RAG-based intelligent question-answering method for ship maintenance still has the following shortcomings: (1) Most of them use undifferentiated full-database vector similarity matching, and do not organize ship fault knowledge in a hierarchical manner that conforms to the diagnostic logic of marine engineers. They cannot distinguish between general faults and scenario-specific faults of specific ship types and specific navigation areas. Furthermore, ship equipment systems are complex, and the main propulsion, auxiliary machinery, steering gear and other systems have high cross-professional and cross-module correlations. When faced with the fuzzy fault descriptions of marine engineers, the existing solutions have poor generalization and insufficient accuracy in the retrieval results, and are prone to recalling a large amount of irrelevant knowledge.

[0004] (2) The knowledge of ship maintenance is not finely labeled and strongly bound with multi-dimensional metadata. It does not cover ship-specific dimensions such as ship type, navigation area, classification society specifications, navigation conditions, and marine environment. The retrieval process cannot accurately filter the on-site working conditions such as high salt spray in the ocean, low temperature in the polar region, and shallow draft in inland waterways. As a result, the generated maintenance plan does not match the actual working conditions of the ship and does not comply with the classification society's maintenance specifications. It cannot pass the ship safety inspection and has extremely poor on-site feasibility.

[0005] (3) The retrieval process of the RAG architecture is completely disconnected from the ship fault diagnosis logic. Ship faults are mostly system-level chain faults. For example, abnormal exhaust temperature of the main engine may involve multiple subsystems such as fuel, lubricating oil, turbocharger, and exhaust valve. The existing solution cannot simulate the chief engineer's progressive fault deduction logic "from system to component, from general to specific". When faced with complex multi-system concurrent faults, the fault location efficiency is low and the troubleshooting steps are highly redundant, which cannot meet the rapid response requirements of ship emergency maintenance.

[0006] (4) The generation process of the ship maintenance Q&A system is not deeply integrated with the mandatory safety regulations and classification society standards in the ship industry. The large model is prone to illusions. The generated maintenance steps do not comply with the mandatory requirements of the SOLAS Convention, ISM Code, etc., and may even contain content that violates the safety red lines such as closed compartment operation and high-pressure system operation, which poses serious risks of ship safety accidents, personnel casualties, and security inspection detention. At the same time, most existing solutions rely on cloud deployment and cannot adapt to the offline lightweight deployment requirements of ocean voyages without public network environment. Summary of the Invention

[0007] To address the aforementioned issues, this invention provides a ship maintenance knowledge question-and-answer method based on hierarchical question subtrees and metadata constraints. This method enables hierarchical and precise location of ship faults and knowledge retrieval adapted to operating conditions, outputting structured maintenance solutions that conform to classification society standards and are adapted to the ship's on-site operating conditions.

[0008] To achieve the above objectives, this invention provides a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints, the method comprising: Obtain a multi-source heterogeneous document dataset related to ship maintenance, preprocess and semantically segment the multi-source heterogeneous document dataset to form a collection of knowledge fragments in text form; Entity recognition is performed on each knowledge fragment, and metadata of multiple dimensions of each knowledge fragment is extracted. The metadata of multiple dimensions is used as attribute tags of the corresponding knowledge fragment. Each knowledge fragment is vectorized and bound to its attribute tags to form a set of knowledge fragments in vector form. For knowledge fragments related to historical ship maintenance failure cases in the vector form of the knowledge fragment set, hierarchical clustering is performed to construct a hierarchical problem subtree with root node-parent node-child node. The root node corresponds to ship equipment failure, the parent node corresponds to the general failure type of the ship's core system, and the child node corresponds to the specific scenario failure. Each child node is associated with the identification information of ship model, equipment model, navigation area and navigation conditions. The system receives natural language questions related to ship maintenance from users in text form, performs entity recognition on the questions, and extracts metadata of at least one dimension from the questions; based on the questions, it identifies the user's question-and-answer intent through an intent classification model. Based on the user's question-and-answer intent, the metadata of at least one dimension in the question is matched layer by layer with the nodes of the hierarchical question subtree to retrieve at least one most relevant knowledge fragment. The question is combined with at least one most relevant knowledge fragment to generate a prompt word. The prompt word is then input into a fine-tuned large language model for the ship maintenance field to output a structured maintenance solution.

[0009] Furthermore, the multi-source heterogeneous document dataset is preprocessed and semantically segmented to form a set of text-based knowledge fragments. This includes preprocessing the multi-source heterogeneous document dataset, which includes data cleaning; performing semantic segmentation on each document in the preprocessed multi-source heterogeneous document dataset to form multiple text-based knowledge fragments, which together form a set of text-based knowledge fragments; assigning unique identifier information to each knowledge fragment, and recording the mapping relationship between each knowledge fragment and the corresponding document in the preprocessed multi-source heterogeneous document dataset, including the document name, chapter, and page number corresponding to each knowledge fragment.

[0010] Furthermore, the above-mentioned ship maintenance knowledge question answering method based on hierarchical question subtrees and metadata constraints also includes, while inputting prompt words into a fine-tuned large language model of the ship maintenance domain and outputting a structured maintenance solution, generating source information for all knowledge fragments in the structured maintenance solution based on the mapping relationship between each knowledge fragment and the corresponding document in the preprocessed multi-source heterogeneous document dataset.

[0011] Furthermore, metadata from multiple dimensions is used as attribute tags for corresponding knowledge fragments. Each knowledge fragment is vectorized and bound to its attribute tags to form a set of knowledge fragments in vector form. This includes constructing a metadata standard dictionary based on national standards and classification society specifications for the shipbuilding industry, mapping the metadata from multiple dimensions of each knowledge fragment to corresponding standard terms to standardize the metadata from multiple dimensions; using the standardized metadata from multiple dimensions as attribute tags for the corresponding knowledge fragments; normalizing multiple text-based knowledge fragments and their attribute tags and inputting them into the embedding model to output multiple vector-based knowledge fragments and their attribute tags; binding each vector-based attribute tag to the unique identifier of the corresponding knowledge fragment, and the multiple vector-based knowledge fragments and their bound attribute tags together form a set of knowledge fragments in vector form.

[0012] Furthermore, common failure types of core ship systems include failures in the main propulsion system, auxiliary machinery system, steering gear and maneuvering system, anchoring and mooring system, electrical and automation system, navigation and communication system, piping and ballast system, and fire protection and emergency system.

[0013] Furthermore, the metadata across multiple dimensions includes ship type, equipment type, fault symptoms, navigation area and operating conditions, marine environmental conditions, and classification society specifications. When at least one dimension of the metadata in the question includes ship type, equipment type, fault symptoms, and navigation area and operating conditions, the metadata of at least one dimension in the question is matched layer by layer with the nodes of the hierarchical question subtree to retrieve at least one most relevant knowledge fragment. This includes matching the fault symptoms in the question with the root node of the hierarchical question subtree to determine the matching root node; combining the fault symptoms in the question with ship type, equipment type, and navigation area and operating conditions, and matching them with the parent nodes of the hierarchical question subtree to determine at least one matching parent node; and traversing the child nodes under at least one matching parent node, using a fine-tuned large language model for the ship maintenance domain. If at least one of the following four matching degrees satisfies a preset matching condition, the corresponding sub-node is added to the candidate sub-node set, and at least one matching sub-node is determined based on the candidate sub-node set; based on at least one matching sub-node, at least one most relevant knowledge fragment is retrieved. The first matching degree between the ship model in the query and the ship model corresponding to all knowledge fragments included in each sub-node; the second matching degree between the equipment model in the query and the equipment model corresponding to all knowledge fragments included in each sub-node; the third matching degree between the fault phenomenon in the query and the fault phenomenon corresponding to all knowledge fragments included in each sub-node; and the fourth matching degree between the navigation area and navigation conditions in the query and the navigation area and navigation conditions corresponding to all knowledge fragments included in each sub-node.

[0014] Furthermore, based on at least one matching child node, at least one most relevant knowledge fragment is retrieved, including selecting at least one from the ship model, equipment model, fault phenomenon, and navigation area and navigation conditions in the question as core metadata, and setting filtering conditions based on the core metadata; according to the filtering conditions, all knowledge fragments included in at least one matching child node are filtered to form a metadata-constrained knowledge subset; based on the metadata-constrained knowledge subset, at least one most relevant knowledge fragment is retrieved.

[0015] Furthermore, based on the knowledge subset constrained by metadata, at least one most relevant knowledge fragment is retrieved, including converting the question into a query vector through an embedding model; calculating the similarity between the query vector and each knowledge fragment in the knowledge subset through a fine-tuned large language model for the ship maintenance domain; and determining the knowledge fragments whose similarity meets the preset requirements as the most relevant knowledge fragments.

[0016] Furthermore, the question and at least one most relevant knowledge fragment are integrated to generate prompt words. These prompt words are then input into a fine-tuned large language model for the ship maintenance domain to output a structured maintenance solution. This includes constructing a standardized rule base and a safety red line base for the ship maintenance domain.

[0017] Furthermore, the standardized rule library and safety red line library in the field of ship repair include rules for prioritizing ship fault diagnosis, standardized maintenance specifications of classification societies, rules for risk warnings of high-risk ship operations, safety red lines of the SOLAS Convention and ISM Code, and simplified operation rules for emergency maintenance during ocean voyages.

[0018] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: (1) The present invention provides a ship maintenance knowledge question answering method based on hierarchical question subtree and metadata constraints. By preprocessing and semantically segmenting the multi-source heterogeneous document dataset related to ship maintenance, multiple knowledge fragments are formed. Metadata of multiple dimensions of each knowledge fragment is extracted to construct a hierarchical question subtree of root node-parent node-child node. When answering questions, the hierarchical question subtree is used to perform layer-by-layer matching to complete the progressive positioning of the fault level and retrieve at least one most relevant knowledge fragment. Then, a structured maintenance plan is generated based on the most relevant knowledge fragment, thereby improving the retrieval accuracy of the ship maintenance knowledge question answering method. Furthermore, by deeply integrating the retrieval process with the marine expert diagnosis logic (i.e., the construction logic of the hierarchical question subtree), the model illusion and compliance risks can be reduced from the root.

[0019] (2) The ship maintenance knowledge question answering method based on hierarchical question subtree and metadata constraints provided by the present invention can further improve the retrieval accuracy of the ship maintenance knowledge question answering method by setting filtering conditions based on core metadata, performing secondary filtering according to the filtering conditions, forming a knowledge subset constrained by metadata, and then performing vector retrieval in the knowledge subset constrained by metadata.

[0020] (3) The ship maintenance knowledge question answering method based on hierarchical question subtree and metadata constraints provided by the present invention constructs a standardized rule base and a safety red line base in the field of ship maintenance; integrates the standardized rule base and the safety red line base in the field of ship maintenance, the question and at least one most relevant knowledge fragment to generate a structured maintenance solution, which can output a structured maintenance solution that conforms to the rules of ship fault troubleshooting priority rules, classification society standardized maintenance specifications and other rules. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints, provided for an embodiment of this application; Figure 2 An architecture diagram of a system corresponding to a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints provided in this application embodiment; Figure 3 This is a schematic diagram of the hierarchical subtree structure of the root node-parent node-child node provided in the embodiments of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0024] The terms "first," "second," "third," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0025] like Figure 1 As shown, a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints is provided. This method can be executed by a terminal or by a server that communicates with the terminal via a network. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, etc. The server can be a standalone server or a server cluster consisting of multiple servers. The method is illustrated using a terminal as an example, including the following steps: Step 101: Obtain a multi-source heterogeneous document dataset related to ship maintenance, preprocess and semantically segment the multi-source heterogeneous document dataset to form a set of knowledge fragments in text form.

[0026] Among them, the multi-source heterogeneous documents related to ship maintenance include documents related to intelligent maintenance and fault diagnosis of ship equipment in industries such as ocean shipping, inland waterway shipping, shipbuilding and repair, port operations, and marine engineering.

[0027] For example, the terminal preprocesses the multi-source heterogeneous document dataset, including data cleaning; semantically segments each document in the preprocessed multi-source heterogeneous document dataset to form multiple text-based knowledge fragments, and the multiple text-based knowledge fragments form a text-based knowledge fragment set; assigns unique identification information to each knowledge fragment, and records the mapping relationship between each knowledge fragment and the corresponding document in the preprocessed multi-source heterogeneous document dataset, the mapping relationship including the document name, chapter, and page number corresponding to each knowledge fragment.

[0028] Step 102: Perform entity recognition on each knowledge fragment, extract metadata of multiple dimensions for each knowledge fragment, use the metadata of multiple dimensions as attribute tags for the corresponding knowledge fragment, vectorize and bind each knowledge fragment with its attribute tags to form a set of knowledge fragments in vector form.

[0029] The metadata, encompassing multiple dimensions, includes ship type, equipment type, fault symptoms, navigation area and operating conditions, marine environmental conditions, and classification society specifications. It should be noted that the ship type characterizes the ship's type and specifications, such as container ship, bulk carrier, tanker, LNG carrier, etc., as well as specifications such as deadweight tonnage, number of containers, main dimensions, and series model. The equipment type refers to the original manufacturer's specifications for the ship's core system equipment, ensuring that maintenance knowledge matches the actual installed equipment on the ship and guaranteeing the feasibility of the proposed solutions.

[0030] For example, the terminal performs entity recognition on each knowledge fragment and extracts metadata of multiple dimensions for each knowledge fragment; standardizes the metadata of multiple dimensions; uses the standardized metadata of multiple dimensions as attribute tags for the corresponding knowledge fragment; normalizes multiple text-based knowledge fragments and their attribute tags and inputs them into the embedding model respectively, outputting multiple vector-based knowledge fragments and their attribute tags; binds each vector-based attribute tag with the unique identification information of the corresponding knowledge fragment, and the multiple vector-based knowledge fragments and their bound attribute tags together form a set of vector-based knowledge fragments.

[0031] Step 103: Perform hierarchical clustering on the knowledge fragments related to historical ship maintenance failure cases in the vector-form knowledge fragment set, and construct a hierarchical problem subtree with root node-parent node-child node.

[0032] The root node corresponds to ship equipment failures, and the parent node corresponds to common failure types of the ship's core systems. These common failure types include failures of the ship's main propulsion system, ship's auxiliary machinery system, steering gear and maneuvering system, anchoring and mooring system, ship's electrical and automation system, navigation and communication system, ship's piping and ballast system, and fire protection and emergency system. The child nodes correspond to failures in specific scenarios, and each child node is associated with identification information such as ship model, equipment model, navigation area, and navigation conditions.

[0033] Step 104: Receive natural language questions related to ship maintenance from users in text form, perform entity recognition on the questions, and extract metadata of at least one dimension of the questions; based on the questions, identify the user's question-and-answer intent through an intent classification model.

[0034] The user's question and answer intent includes at least one of the following: fault diagnosis, maintenance procedure query, classification society compliance consultation, equipment principle explanation, and emergency maintenance handling.

[0035] Step 105: Based on the user's question-and-answer intent, match the metadata of at least one dimension of the question with the nodes of the hierarchical question subtree layer by layer to retrieve at least one most relevant knowledge fragment.

[0036] For example, when a user's question-and-answer intent includes at least one of fault diagnosis, maintenance procedure query, and emergency maintenance handling, the terminal performs layer-by-layer matching of metadata from at least one dimension of the question with nodes of the hierarchical question subtree to retrieve at least one most relevant knowledge fragment. If the user's question-and-answer intent is for classification society compliance consultation or equipment principle explanation, and the question does not involve a specific fault scenario, the terminal does not need to perform layer-by-layer matching of the hierarchical question subtree. Instead, it searches within the corresponding subset of regulatory knowledge or equipment principle knowledge based on metadata such as classification society regulatory requirements and equipment model in the question. If the classification society compliance consultation or equipment principle explanation also involves a specific fault scenario, or constitutes a composite intent with fault diagnosis, maintenance procedure query, or emergency maintenance handling, the terminal performs layer-by-layer matching of the hierarchical question subtree and performs a joint search in conjunction with the corresponding subset of regulatory knowledge or equipment principle knowledge.

[0037] Specifically, firstly, the terminal matches the fault phenomenon in the question with the root node of the hierarchical question subtree to determine the matching root node; then, it combines the fault phenomenon in the question with the ship model, equipment model, and navigation area and sailing conditions, and matches it with the parent node of the hierarchical question subtree to determine at least one matching parent node; finally, it traverses the child nodes under at least one matching parent node, and calculates the first matching degree between the ship model in the question and the ship model corresponding to all knowledge fragments included in each child node, the second matching degree between the equipment model in the question and the equipment model corresponding to all knowledge fragments included in each child node, the third matching degree between the fault phenomenon in the question and the fault phenomenon corresponding to all knowledge fragments included in each child node, and the fourth matching degree between the navigation area and sailing conditions corresponding to all knowledge fragments included in each child node. If at least one of the first matching degree, second matching degree, third matching degree, and fourth matching degree satisfies a preset matching condition, the corresponding child node is added to the candidate child node set, and at least one matching child node is determined based on the candidate child node set.

[0038] Then, the terminal selects at least one of the following as core metadata from the ship model, equipment model, fault phenomenon, navigation area and navigation conditions in the query: the core metadata is used to set filtering conditions; according to the filtering conditions, all knowledge fragments included in at least one matching child node are filtered to form a knowledge subset constrained by metadata; the query is transformed into a query vector through an embedding model; the similarity between the query vector and each knowledge fragment in the knowledge subset is calculated through a fine-tuned large language model of the ship maintenance domain; the knowledge fragments whose similarity meets the preset requirements are determined as the most relevant knowledge fragments, and at least one most relevant knowledge fragment is retrieved.

[0039] Step 106: Merge the question with at least one most relevant knowledge fragment to generate prompt words, input the prompt words into the fine-tuned large language model for ship maintenance, and output a structured maintenance solution.

[0040] The structured maintenance plan includes six modules: emergency response plan, root cause analysis of failures, standardized troubleshooting sequence, compliant maintenance procedures, classification society compliance tips, and operational risk warnings.

[0041] The aforementioned ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints preprocesses and semantically segments a multi-source heterogeneous document dataset related to ship maintenance, forming multiple knowledge fragments. Metadata from multiple dimensions of each knowledge fragment is extracted to construct a hierarchical question subtree of root node-parent node-child node. During user question answering, the hierarchical question subtree is used for layer-by-layer matching to progressively locate the fault level, retrieving at least one most relevant knowledge fragment. Then, a structured maintenance plan is generated based on this most relevant knowledge fragment, thereby improving the retrieval accuracy of the ship maintenance knowledge question-answering method. Furthermore, by deeply integrating the retrieval process with the marine engineering expert diagnostic logic (i.e., the construction logic of the hierarchical question subtree), model illusion and compliance risks can be reduced at the root.

[0042] In one embodiment, step 106 above involves fusing the question with at least one most relevant knowledge fragment to generate prompt words, inputting the prompt words into a fine-tuned large language model for the ship repair field, and outputting a structured repair solution. This also includes constructing a standardized rule base and a safety red line library for the ship repair field. The standardized rule base and safety red line library for the ship repair field, along with the question and at least one most relevant knowledge fragment, are fused to generate prompt words. These prompt words are then input into a fine-tuned large language model for the ship repair field, and a structured repair solution is output. The standardized rule base and safety red line library for the ship repair field include ship fault diagnosis priority rules, classification society standardized repair specifications, ship high-risk operation risk warning rules, SOLAS Convention and ISM Code safety red lines, and simplified operation rules for emergency repairs during ocean voyages.

[0043] Figure 2 This is an architecture diagram of a system corresponding to a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints in one embodiment. (Reference) Figure 2 This embodiment provides a ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints, including the following 6 steps executed sequentially: Step 1: Preprocessing and Knowledge Fragment Construction of Multi-Source Heterogeneous Ship Maintenance Documents. This involves collecting six categories of heterogeneous documents: original equipment manufacturer (OEM) maintenance manuals, historical fault cases, experience records of chief engineers / senior engineers, classification society maintenance specifications, ship safety operation specifications, and ship ISM Code operation manuals. First, the documents undergo data cleaning, including deduplication, normalization of ship maintenance terminology, and removal of invalid headers, footers, and redundant content. Then, a document segmentation algorithm based on semantic boundary recognition is used to semantically segment the cleaned documents, forming independent, complete, and semantically closed-loop knowledge fragments. Each knowledge fragment is assigned a unique knowledge ID, and a source mapping relationship between the knowledge fragment and the original document is established, including information such as document name, chapter, and page number.

[0044] This step addresses the issues of inconsistent document formats and fragmented knowledge across systems in the field of ship repair. Semantic segmentation ensures that each knowledge fragment possesses independent ship repair knowledge expression capabilities, laying a data foundation for subsequent metadata extraction and vector retrieval. Simultaneously, the established source mapping relationship can effectively trace the source of knowledge, reduce the risk of large model illusion, and meet the compliance requirements of traceability and verifiability in ship repair.

[0045] Step 2: Automatic extraction and binding of multi-dimensional metadata in the shipbuilding field. Specifically, this involves extracting entities from each knowledge fragment based on a pre-trained named entity recognition model for the ship maintenance field, extracting metadata for six core dimensions: ship type (referred to as ship type), equipment type, fault phenomenon, navigation area and navigation conditions, marine environmental conditions, and classification society specifications. The extracted metadata is then standardized and normalized to construct a standard dictionary of metadata for the ship maintenance field, mapping non-standardized expressions to industry standard terms, including the standardization and unification of ship type, navigation area, classification society specifications, and equipment type. Finally, the standardized metadata is strongly bound to the corresponding vectorized knowledge fragments and stored as attribute tags for the knowledge fragments in the knowledge base and vector database.

[0046] This step enables multi-dimensional and refined annotation of ship maintenance knowledge, providing ship-specific metadata constraints for subsequent retrieval processes. This ensures that retrieval results accurately match actual scenario information such as ship type, navigation area, classification society requirements, and on-site working conditions, addressing the core pain point of existing technical solutions generating content that does not match on-site ship working conditions or meet compliance requirements.

[0047] Step 3: Construction of a hierarchical subtree for ship maintenance based on historical failure cases. This specifically includes using a density-based clustering algorithm to hierarchically cluster failure cases from a historical ship maintenance failure case dataset, constructing a hierarchical subtree with a three-level structure of "root node - parent node - child node" (e.g., ...). Figure 3(As shown in the diagram). The system consists of one root node, eight parent nodes, and multiple child nodes, the number of which varies depending on the historical ship maintenance failure case dataset and clustering results. The root node represents "ship equipment failure," and the parent nodes represent common failure types in the ship's core systems, corresponding to common failure phenomena in the eight core systems: main propulsion system failure, auxiliary machinery system failure, steering and maneuvering system failure, anchoring and mooring system failure, electrical and automation system failure, navigation and communication system failure, piping and ballast system failure, and fire and emergency system failure. The child nodes represent specific scenario failures, corresponding to subdivided failure scenarios under specific ship types, navigation areas, equipment models, and operating conditions. Each child node is bound to corresponding dimension metadata constraints and knowledge IDs of relevant knowledge fragments. Based on the experience of marine engineering experts, causal relationship rules and progressive troubleshooting logic are established between parent and child nodes, matching the standard diagnostic process of marine engineering maintenance: "system first, component second; external first, internal third; simple first, complex second; emergency first, radical second."

[0048] In this step, by constructing a hierarchical fault system that conforms to the diagnostic logic of marine engineering experts, the traditional undifferentiated vector retrieval is transformed into a progressive retrieval that "first locates the fault level and then matches the specific scenario". This can solve the problem of insufficient retrieval accuracy of existing technologies when faced with fuzzy fault descriptions. At the same time, the causal association rules of parent and child nodes provide logical support for the multi-step deduction of subsequent complex ship system faults, which can adapt to the rapid diagnostic needs of ship emergency maintenance.

[0049] Step 4: Entity and intent recognition of user input. This specifically includes receiving natural language questions from users, preprocessing the user input text (including spelling correction, normalization of colloquial expressions, and stop word removal), extracting six core entity information from the user input using a ship maintenance entity recognition model, including ship model, target equipment model, fault type, navigation conditions and area, environmental conditions, and classification society requirements. Simultaneously, based on a finely tuned intent classification model, the core question-and-answer intent of the user is identified, including five categories: fault diagnosis, maintenance procedure query, classification society compliance consultation, equipment principle explanation, and emergency maintenance handling, thus completing the structured parsing of the user's questions.

[0050] This step accurately analyzes the vague, colloquial questions posed by marine engineers, extracts core constraint entities and question-and-answer intent, and provides precise input conditions for subsequent question subtree location and metadata constraint retrieval, ensuring that the question-and-answer process fully meets the user's actual ship maintenance needs.

[0051] Step 5: Two-level knowledge retrieval based on question subtree and metadata constraints is the core step of this embodiment of the invention. It is specifically divided into two progressively executed retrieval stages: First stage: Question subtree hierarchical positioning. The fault type entity extracted by the user is input into the question subtree. First, the corresponding general fault parent node of the ship's core system is matched. Then, combined with the ship type, target equipment model, navigation area and operating condition entities, the child nodes under the parent node are traversed. The semantic similarity and metadata matching degree between the child nodes and the user input are calculated to complete the accurate positioning of the child nodes and lock the knowledge ID set corresponding to the target fault scenario. Second stage: Vector retrieval of metadata constraints. The knowledge ID set locked in the first stage is used as the retrieval scope. Based on the core entity input by the user, metadata filtering conditions are set to perform a second filtering on the retrieval scope. Knowledge fragments that do not match the ship type, navigation area, classification society specifications and operating conditions are filtered out to form a knowledge subset with metadata constraints. The user's natural language question is converted into a query vector through a pre-trained embedding model. Vector similarity retrieval is performed within the knowledge subset to recall the Top-N (greater than or equal to 1) most relevant knowledge fragments, completing the knowledge retrieval process.

[0052] In this step, a two-level retrieval mechanism is used. First, the fault scenario is coarsely located through the problem subtree, which greatly narrows the retrieval scope. Then, the metadata constraints of the ship-specific dimension are used to achieve precise filtering, which solves the problems of poor generalization and irrelevant content recall in traditional pure vector retrieval. At the same time, the retrieval process is fully aligned with the diagnostic logic of marine engineering experts from general to specific, which greatly improves the matching degree between the retrieval results and the user's actual ship maintenance needs.

[0053] Step 6: Generate a structured maintenance solution integrating ship maintenance rules. This includes a pre-set standardized rule base and safety red line base for the ship maintenance field. The rule base contains five core rule categories: ① Ship fault investigation priority rules (system first, then component; external first, then internal; simple first, then complex; emergency first, then root cause); ② Classification society standardized maintenance specifications (major classification societies such as CCS / ABS / LR / DNV); ③ Risk warning rules for high-risk ship operations (high-pressure fuel system operation, closed compartment operation, live electrical work, main engine disassembly and inspection specifications, etc.); ④ SOLAS Convention and ISM Code safety red lines; ⑤ Simplified operation rules for emergency maintenance during ocean voyages. The knowledge fragments recalled in S5 and the rule base are input into a fine-tuned large language model for the ship maintenance field. The output format and content boundaries of the model are constrained by the prompt word engineering. Based on the knowledge fragments and maintenance rules, the model outputs a structured maintenance solution containing six modules: emergency response plan, root cause analysis of faults, standardized troubleshooting sequence, compliant maintenance steps, classification society compliance prompts, and operational risk warnings. At the same time, the source information of the knowledge fragments is marked in the solution.

[0054] In this step, by deeply integrating mandatory compliance rules in the shipping industry with retrieved knowledge, strong constraints are imposed on the generation process of the large model. This reduces model illusion at its source and outputs a structured solution that conforms to marine engineering operation specifications and meets the compliance requirements of classification societies. It also includes clear emergency response procedures and risk warnings, solving the problems of non-compliance and safety hazards in the content generated by existing technologies. This significantly improves the practicality, safety, and compliance of maintenance solutions.

[0055] The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints provided in this embodiment is based on the expert thinking logic of ship engine maintenance, which is "from system to component, from general to specific, and from emergency to radical treatment". It uses hierarchical question subtrees as the logical skeleton of fault diagnosis and ship-specific dimensional metadata as precise constraints on working conditions. This breaks the limitations of the traditional RAG architecture's indiscriminate vector retrieval and achieves deep integration of the retrieval process with the ship fault diagnosis logic. At the same time, through the strong binding of metadata and knowledge fragments, the retrieval process can fully combine on-site working condition information such as ship type, navigation area, classification society specifications, and marine environment, ensuring that the generated maintenance plan is highly adapted to the actual ship scenario. Finally, through the ship maintenance rule base, the large model generation process is strongly constrained, which not only improves the accuracy of question answering but also effectively avoids model illusion and compliance risks. This achieves accurate, safe, compliant, and practical intelligent question answering in the field of ship maintenance, and can also be adapted to offline lightweight deployment in ocean environments without public network access.

[0056] Compared with existing traditional ship maintenance intelligent question answering technologies, the ship maintenance knowledge question answering method based on hierarchical question subtrees and metadata constraints provided in this embodiment has the following advantages: (1) The accuracy of retrieval and the accuracy of question answering are greatly improved: Compared with the traditional pure vector retrieval scheme, the two-level retrieval mechanism of this invention improves the accuracy of knowledge recall by 45% and the Top 3 recall rate from 66% to 96%; on a test question and answer set of 120,000 ship maintenance fields, the accuracy of question and answer results is improved from 69% to 93%, and the scenario matching degree of fault diagnosis is improved by 39%.

[0057] (2) Significantly enhanced adaptability and compliance: Through the constraints of metadata specific to ships, the matching degree between the maintenance plan generated by this invention and the ship type, navigation area and on-site working conditions has increased from 62% to 94%, and the compliance rate of classification society standards has increased from 58% to 100%. This effectively solves the pain points of existing solutions, which are "too many general solutions, too few scenario-based solutions and insufficient compliance", and the on-site executability of the solution has increased by 48%.

[0058] (3) The illusion of the model and the safety risks are greatly reduced: Through the dual constraints of the knowledge fragment tracing mechanism and the ship maintenance rule base, the illusion rate of the question and answer results of the present invention is reduced from 41% of the existing scheme to less than 4%, and the illusion rate of high-risk operation and compliance-related content is reduced to 0, which completely avoids the risks of ship safety accidents, casualties, and security inspection delays caused by the fictional content of the model.

[0059] (4) Significantly improved efficiency in fault diagnosis and emergency response: The progressive positioning of the hierarchical problem subtree perfectly matches the fault diagnosis thinking of marine engineers. When faced with complex multi-system concurrent faults on ships, the fault location time is shortened by 65%, the redundancy of the troubleshooting steps is reduced by 72%, and the trial and error cost of marine engineers is greatly reduced, meeting the rapid response needs of ship emergency maintenance.

[0060] (5) Strong adaptability to all scenarios: This method is compatible with both high-performance GPU environments and low-power CPU offline environments. In the GPU environment of shipping companies / shipyards, more than 80% of user questions can return results within 10 seconds; in the offline environment of ordinary CPU edge devices in ship engine rooms and without public network, more than 80% of user questions can return results within 30 seconds, meeting the deployment needs of all scenarios such as fixed scenarios in shipyards and offline scenarios in ocean voyages.

[0061] In one embodiment, a knowledge-based question-answering method for ship maintenance, based on hierarchical question subtrees and metadata constraints, is provided for implementation in a GPU high-performance environment in the field of ocean-going container ship maintenance. The deployment environment for this method is as follows: Hardware environment: Deployed in the shipping company's headquarters data center, the server is configured with 2 Intel Xeon 8375C CPUs (32 cores 2.9GHz), 512GB DDR4 memory, and 2 NVIDIA RTX 4090 24GB graphics cards; Software environment: Ubuntu 22.04 LTS operating system, Docker 25.0.3 container engine, Dify LLMOps platform, Qdrant 1.9.0 vector database, Llama-3.3-70B-Instruct large language model, bge-m3 embedding model, and PEFT 0.12.0 LoRA fine-tuning framework.

[0062] This method includes the following 6 steps executed sequentially: Step 1: Preprocessing of Ship Repair Documents and Construction of Knowledge Fragments We collected core documents from the shipbuilding industry, including 1,500 original equipment manufacturer (OEM) maintenance manuals from MAN B&W and Wärtsilä, 100,000 historical failure cases from ocean-going vessels, 4,000 experience records from senior chief engineers and first engineers, 600 maintenance specifications from major classification societies such as CCS, ABS, and LR, SOLAS Convention and ISM Code operation manuals, and 800 original equipment manufacturer (OEM) operation manuals for ship equipment, forming a multi-source heterogeneous document dataset. First, we performed data cleaning: using regular expressions to remove invalid headers and footers, duplicate paragraphs, and irrelevant content from the documents; then, we constructed a terminology dictionary for ship maintenance, normalizing synonyms such as "main engine overspeed / main engine runaway" and "steering gear jamming / steering gear malfunction" to conform to standard shipbuilding industry terminology. Semantic segmentation is then performed: The LangChain semantic segmentation algorithm based on semantic boundary recognition is adopted, with a segmentation block size of 512 tokens and an overlap rate of 15%. The cleaned documents are segmented to form 352,000 semantically closed knowledge fragments. Each knowledge fragment is assigned a unique UUID as a knowledge ID, and the original document name, chapter, and page number corresponding to each knowledge fragment are recorded to establish a source mapping relationship and store it in the PostgreSQL knowledge base.

[0063] Step 2: Extraction and Binding of Metadata in the Ship Domain Based on a BERT-based pre-trained model, a named entity recognition model for the ship maintenance domain was constructed using 12,000 manually annotated ship maintenance corpora for fine-tuning. Entity types included six categories: ship type, equipment type, fault phenomenon, navigation area and operating conditions, marine environmental conditions, and classification society specifications. The model achieved an F1 score of 93.1% for entity recognition. This model was used to extract entities from 352,000 knowledge fragments in batches, extracting six dimensions of metadata for each fragment. Based on national shipbuilding standards and classification society specifications, a metadata standard dictionary was constructed, mapping the extracted non-standardized metadata to standard terminology. For example, ship types were standardized as container ships, bulk carriers, tankers, and LNG carriers; navigation areas as unlimited navigation areas, coastal navigation areas, and inland waterway navigation areas; and classification society specifications as standard expressions such as CCS, ABS, LR, and DNV. The standardized metadata was used as attribute tags, bound to the knowledge ID of the corresponding knowledge fragment, and stored in the payload field of the Qdrant vector database, achieving a strong association between metadata and knowledge fragments.

[0064] Step 3: Construction of the Subtree for the Hierarchical Problem of Ship Repair A dataset of 80,000 high-quality historical failure cases of ocean-going vessels was selected. The DBSCAN density clustering algorithm was used, with a clustering neighborhood radius ε=0.3 and a minimum sample size MinPts=10, to perform hierarchical clustering of the failure cases. First, the root node 201 of the problem subtree was constructed as "Ship Equipment Failure". Based on the clustering results, eight general failure parent nodes 202 were generated, including failures in the ship's main propulsion system, auxiliary machinery system, steering gear and maneuvering system, and other eight core ship systems. Under each parent node, specific scenario failure sub-nodes 203 were generated based on the clustering results, totaling 389 sub-nodes. For example, under the "Main Propulsion System Failure" parent node, specific scenario sub-nodes included "MAN B&W 6S60ME-C8 main engine exhaust temperature too high under high salt spray conditions in unlimited navigation areas" and "Wärtsilä 32 auxiliary engine start-up failure under polar low temperature conditions". Each child node is bound to a corresponding metadata constraint 204 (ship type, navigation area, equipment model, classification society, etc.), and associated with the knowledge ID 205 of the corresponding knowledge fragment. Based on the experience of marine engineering experts, fault causal association rules and progressive troubleshooting logic are established between parent and child nodes. For example, under the parent node "main engine exhaust temperature too high", the troubleshooting order of child nodes is set according to the priority of "fuel system → lubricating oil system → turbocharger system → exhaust valve and piston components → control system", which fully matches the standard diagnostic process of marine engineering maintenance and completes the construction of hierarchical problem subtrees.

[0065] Step 4: User Input Parsing and Processing The system receives a natural language question from the ship's chief engineer: "My ship is an 18,000 TEU container ship equipped with a MAN B&W 6S60ME-C8 main engine, classified by CCS, operating in unlimited navigation areas. Under full load conditions, the exhaust temperature of all cylinders of the main engine is generally high, the ambient temperature is 38℃, and there is high salt spray. How should we troubleshoot and repair this?" First, the user input is preprocessed: spell correction, colloquialization, and stop word removal are performed to obtain a standardized question text. Then, a fine-tuned entity recognition model is used to extract the core entities: ship type "18,000 TEU container ship", target equipment model "MAN B&W 6S60ME-C8 main engine", fault type "generally high exhaust temperature of all cylinders of the main engine", navigation conditions and area "unlimited navigation area, full load navigation", environmental conditions "ambient temperature 38℃, high salt spray", and classification society requirement "CCS specifications". Finally, an intent classification model identifies the user's core intent as "fault diagnosis +". "Compliant Repair Procedure Inquiry" completes the structured parsing of user input.

[0066] Step 5: Two-level knowledge retrieval execution Phase 1: Problem subtree hierarchical location 302. Input the fault type "generally high exhaust temperature of all cylinders of the main engine" into the problem subtree. First, it matches the general fault parent node 202 "Main propulsion system fault of the ship". Then, combined with the ship type, equipment model, navigation area, operating condition and environmental conditions entities, it traverses all child nodes under this parent node. The semantic similarity between the child node and the user input is calculated by cosine similarity. Combined with the metadata matching degree, the subnode 203 "MAN B&W6S60ME-C8 main engine exhaust temperature is too high under high salt spray conditions in unlimited navigation area" is finally accurately located, and the set of 142 knowledge IDs associated with this subnode 305 is locked. The second stage: Vector retrieval of metadata constraints 306. With a set of 142 knowledge IDs as the retrieval scope, based on the user input of "18000TEU container ship, CCS classification society, unlimited navigation area, 38℃ high salt spray environment, full load operating conditions", metadata filtering conditions are set to further filter the retrieval scope, filtering out knowledge fragments that do not match the equipment model, classification society specifications, and operating conditions, ultimately forming a metadata-constrained knowledge subset 307 containing 97 knowledge fragments. The user's natural language query is transformed into a 1024-dimensional query vector through the bge-m3 embedding model. Cosine similarity vector retrieval is performed within the knowledge subset to recall the top 10 most relevant knowledge fragments 309, completing the knowledge retrieval process.

[0067] Step 6: Generation of Structured Maintenance Solution A pre-built ship maintenance rule base includes five core rule categories: ① Ship fault diagnosis priority rules; ② CCS classification and construction rules for steel seagoing vessels; ③ Risk warning rules for high-risk ship operations (operation of high-pressure fuel systems, work in confined spaces, main engine disassembly and inspection standards, etc.); ④ SOLAS Convention safety operation red lines; ⑤ Emergency maintenance rules for ocean voyages. The recalled Top 10 knowledge fragments and the maintenance rule base are input into the Llama-3.3-70B-Instruct model, which has been fine-tuned using the LoRA ship maintenance corpus. The model output format is constrained by prompt word templates to be a structured form of "Emergency Response Plan → Fault Root Cause Analysis → Standardized Troubleshooting Sequence → Compliant Maintenance Steps → CCS Compliance Warning → Operational Risk Alert." All content must be based on the recalled knowledge fragments, and fabricated content is prohibited. The model ultimately outputs a structured maintenance plan, the core contents of which include: ① Emergency response plan: For full-load navigation conditions, three emergency response measures are provided during navigation, namely, reduced load operation, online water washing of the turbocharger, and adjustment of fuel inlet temperature, to prevent the fault from escalating; ② Root cause analysis: Combining the high salt spray environment of unlimited navigation areas, the high temperature environment of 38℃, and the full-load condition, five potential root causes of excessive exhaust temperature are analyzed in descending order of probability, including salt spray buildup on the turbocharger compressor impeller, fuel system failure, scavenging system leakage, poor exhaust valve sealing, and timing deviation; ③ Standardized troubleshooting sequence: Following the standard marine engine troubleshooting logic of "fuel system first → scavenging and turbocharger system → exhaust system → timing and mechanical components → control system", 14 progressive troubleshooting operations are listed, with each step specifying the testing method, parameter standards, and judgment criteria; ④ Compliant maintenance steps: For each potential root cause, standardized maintenance operations in accordance with CCS specifications are provided, including tool type, disassembly and assembly specifications, installation parameters, and testing standards; ⑤ CCS Compliance Tips: Clearly indicate the relevant clauses of the CCS steel seagoing vessel classification regulations that must be met after repairs; repair records must be kept for future reference to ensure ship safety inspection compliance; ⑥ Operational Risk Warnings: Mark 4 high-risk operations, including "the main power supply must be disconnected, the fuel inlet and outlet valves must be closed and warning signs must be posted before disassembling and inspecting the main engine"; "the scavenging air box must be fully ventilated before inspection, and entry is only allowed after passing oxygen and explosion tests, and the closed compartment operation specifications must be followed"; "the high-pressure fuel system must be depressurized before maintenance, and disassembly and assembly under pressure is prohibited"; "bench testing is required after repairs, and the vessel can only be put into full-load operation after the parameters meet the standards"; at the same time, the solution marks the corresponding knowledge fragment traceability information for each technical point, completing the entire Q&A process.

[0068] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0069] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0070] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of embodiments of this disclosure upon considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described herein. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

[0071] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0072] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints, characterized in that, include: Obtain a multi-source heterogeneous document dataset related to ship maintenance, preprocess and semantically segment the multi-source heterogeneous document dataset to form a set of knowledge fragments in text form; Entity recognition is performed on each knowledge fragment, and metadata of multiple dimensions for each knowledge fragment is extracted. The metadata of multiple dimensions is used as attribute tags for the corresponding knowledge fragments. Each knowledge fragment is vectorized and bound to its attribute tags to form a set of knowledge fragments in vector form. The metadata of multiple dimensions includes ship type, equipment type, fault phenomenon, navigation area and navigation conditions, marine environmental conditions and classification society specifications. For the knowledge fragments related to historical ship maintenance failure cases in the knowledge fragment set in vector form, hierarchical clustering is performed to construct a hierarchical problem subtree with root node-parent node-child node, where the root node corresponds to ship equipment failure, the parent node corresponds to the general failure type of the ship's core system, and the child node corresponds to the specific scenario failure. Each child node is associated with the identification information of ship model, equipment model, navigation area and navigation conditions. The system receives natural language questions related to ship maintenance from users in text form, performs entity recognition on the questions, and extracts metadata of at least one dimension from the questions; based on the questions, it identifies the user's question-and-answer intent through an intent classification model. If at least one dimension of the metadata in the question includes ship type, equipment type, fault symptoms, and navigation area and operating conditions, based on the user's question-answering intent, the metadata of at least one dimension of the question is matched layer by layer with the nodes of the hierarchical question subtree to retrieve at least one most relevant knowledge fragment, specifically including: Match the fault symptoms in the question with the root node of the hierarchical question subtree to determine the matching root node; The fault phenomena in the question are combined with the ship model, equipment model, navigation area and navigation conditions, and matched with the parent node of the hierarchical question subtree to determine at least one matching parent node. Traverse the child nodes under at least one matching parent node, and calculate the first matching degree between the ship model in the question and the ship model corresponding to all knowledge fragments included in each child node, the second matching degree between the equipment model in the question and the equipment model corresponding to all knowledge fragments included in each child node, the third matching degree between the fault phenomenon in the question and the fault phenomenon corresponding to all knowledge fragments included in each child node, and the fourth matching degree between the navigation area and navigation conditions in the question and the navigation area and navigation conditions corresponding to all knowledge fragments included in each child node, using the fine-tuned large language model of the ship maintenance domain. If at least one of the first matching degree, second matching degree, third matching degree and fourth matching degree satisfies the preset matching condition, add the corresponding child node to the candidate child node set, and determine at least one matching child node based on the candidate child node set; Select at least one of the following as core metadata from the query: ship model, equipment model, fault phenomenon, navigation area, and navigation conditions. Set filtering conditions based on the core metadata. According to the filtering conditions, filter all knowledge fragments included in the at least one matching child node to form a knowledge subset constrained by metadata. Transform the query into a query vector through an embedding model. Calculate the similarity between the query vector and each knowledge fragment in the knowledge subset using a fine-tuned large language model for ship maintenance. Determine the knowledge fragments whose similarity meets the preset requirements as the most relevant knowledge fragments. The question and at least one most relevant knowledge fragment are merged to generate prompt words. These prompt words are then input into a fine-tuned large language model for the ship maintenance field to output a structured maintenance solution.

2. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 1, characterized in that, The preprocessing and semantic segmentation of the multi-source heterogeneous document dataset to form a set of knowledge fragments in text form includes: The multi-source heterogeneous document dataset is preprocessed, and the preprocessing includes data cleaning. Semantic segmentation is performed on each document in the preprocessed multi-source heterogeneous document dataset to form multiple text-based knowledge fragments, which together form a text-based knowledge fragment set. Each knowledge fragment is assigned a unique identifier, and the mapping relationship between each knowledge fragment and the corresponding document in the preprocessed multi-source heterogeneous document dataset is recorded. The mapping relationship includes the document name, chapter, and page number corresponding to each knowledge fragment.

3. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 2, characterized in that, The method further includes: By inputting the prompt words into the fine-tuned large language model for ship maintenance, and outputting a structured maintenance solution, the source information of all knowledge fragments in the structured maintenance solution is generated based on the mapping relationship between each knowledge fragment and the corresponding document in the preprocessed multi-source heterogeneous document dataset.

4. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 1, characterized in that, The method of using multi-dimensional metadata as attribute tags for corresponding knowledge fragments, and vectorizing and binding each knowledge fragment with its attribute tags to form a vector-based set of knowledge fragments includes: Based on the requirements of national standards and classification society specifications in the shipbuilding industry, a metadata standard dictionary is constructed to map the metadata of multiple dimensions of each knowledge fragment to the corresponding standard terms, so as to standardize the metadata of multiple dimensions. Standardized metadata from multiple dimensions is used as attribute tags for the corresponding knowledge fragments; After normalizing multiple text-based knowledge fragments and their attribute labels, they are input into the embedding model, which outputs multiple vector-based knowledge fragments and their attribute labels. Each vector-based attribute label is bound to the unique identifier of the corresponding knowledge fragment. Multiple vector-based knowledge fragments and their bound attribute labels together form a vector-based knowledge fragment set.

5. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 1, characterized in that, The common fault types of the ship's core systems include faults in the ship's main propulsion system, auxiliary machinery system, steering gear and maneuvering system, anchoring and mooring system, electrical and automation system, navigation and communication system, piping and ballast system, and fire protection and emergency system.

6. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 1, characterized in that, The process involves fusing the question with at least one most relevant knowledge fragment to generate prompt words, inputting these prompt words into a fine-tuned large language model for ship maintenance, and outputting a structured maintenance solution, including: Establish a standardized rule base and a safety red line base for the ship repair industry; The standardized rule base for ship maintenance is integrated with the safety red line base, the question, and at least one most relevant knowledge fragment to generate prompt words. These prompt words are then input into a fine-tuned large language model for ship maintenance to output a structured maintenance solution.

7. The ship maintenance knowledge question-answering method based on hierarchical question subtrees and metadata constraints as described in claim 6, characterized in that, The standardized rule base and safety red line base in the field of ship repair include rules for prioritizing ship fault diagnosis, standardized maintenance specifications of classification societies, rules for risk warning of high-risk ship operations, safety red lines of the SOLAS Convention and ISM Code, and simplified operation rules for emergency maintenance during ocean voyages.