A shipping accident analysis method and device, computer equipment and storage medium

By constructing a shipping accident knowledge graph and combining it with a Bayesian network analysis model, the problem of insufficient accuracy of large language models in analyzing shipping accidents is solved, and efficient and accurate risk warning is achieved.

CN120994793BActive Publication Date: 2026-04-10SHANGHAI JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing large language models struggle to accurately extract the causes of shipping accidents and provide early warnings of shipping risks when analyzing shipping incidents, resulting in low reliability of risk warning conclusions.

Method used

A shipping accident knowledge graph is constructed, employing a retrieval-enhanced generation method and a Bayesian network analysis model. The query statement is generated by parsing the question through a large language model, and nodes and edges are retrieved in the knowledge graph. The causal probability is calculated to generate the answer.

Benefits of technology

It improves the accuracy and efficiency of shipping accident analysis, can clarify causal chains, provide reliable risk warning conclusions, and overcomes the errors generated by single query statements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994793B_ABST
    Figure CN120994793B_ABST
Patent Text Reader

Abstract

The application discloses a shipping accident analysis method, comprising the following steps: constructing a shipping accident knowledge graph; inputting a question, searching the shipping accident knowledge graph by using a search enhancement generation method, and generating an answer; wherein the search enhancement generation method comprises the following steps: analyzing the question by using a large language model, generating a query statement, searching the shipping accident knowledge graph according to the query statement, outputting nodes and edges matched with the query statement from the shipping accident knowledge graph, generating a Bayesian network according to the matched nodes and edges, generating a query result according to the conditional probability of a target node and its parent nodes and / or the posterior probability of the target node and its child nodes in the Bayesian network, inputting the query result into the large language model, and generating an answer according to the query result by the large language model. The application further discloses a shipping accident analysis device, a computer device and a storage medium. By using a large language model combined with a knowledge graph to extract and store shipping accident data, and by using a Bayesian network analysis model to analyze the shipping accident data, the occurrence probability of a complete cause-and-effect chain from causes to results of an accident can be obtained, so that objective and accurate causes and effects of a complex shipping accident can be sorted out, and reliable conclusion opinions can be provided for subsequent shipping business.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of ship navigation, in particular to a navigation accident analysis method and device, computer equipment and a storage medium. BACKGROUND

[0002] In the marine transportation industry, navigation accidents seriously threaten navigation safety. The navigation accidents that have occurred are usually recorded and stored in the form of accident reports. In subsequent navigation business, by referring to the relevant accident reports, early warning and guidance can be provided for the navigation business to be carried out.

[0003] A common way of analyzing accident reports is manual analysis, that is, manually collecting accident reports related to navigation business, extracting information from the accident reports, and making corresponding adjustments and plans according to the obtained information. However, manual analysis of navigation accident reports is inefficient and depends on personal experience, and the results obtained are relatively one-sided, making it difficult to efficiently and accurately warn of navigation risks and provide countermeasures.

[0004] Large language models can understand and analyze user questions through large database training, and then output answers in the form of natural language, which is expected to overcome the problem of low efficiency of manual analysis. However, navigation accident causes are complex, and existing large language models still have many difficulties in extracting report semantics and clarifying accident causes, resulting in large language models being unable to accurately analyze navigation accident causes and warn of navigation risks. SUMMARY

[0005] In view of the technical problems existing in the prior art, the present application provides a navigation accident analysis method and device, which can solve the problem that large language models cannot accurately warn of navigation risks and provide reasonable guidance schemes.

[0006] In a first aspect, the present application provides a navigation accident analysis method, which comprises:

[0007] constructing a navigation accident knowledge graph;

[0008] inputting a question, using a retrieval enhancement generation method to retrieve the navigation accident knowledge graph, and generating an answer;

[0009] The retrieval enhancement generation method for retrieving the navigation accident knowledge graph and generating an answer comprises:

[0010] using a large language model to analyze the question and generate a query statement;

[0011] retrieving in the navigation accident knowledge graph according to the query statement, outputting nodes and edges matched with the query statement from the navigation accident knowledge graph, and generating a Bayesian network according to the matched nodes and edges.

[0012] According to the conditional probability of the target node and its parent node in the Bayesian network and / or the posterior probability of the target node and its child node, a query result is generated, and the query result is input into the large language model;

[0013] The large language model generates an answer according to the query result.

[0014] Optionally, a shipping accident knowledge graph is constructed, including:

[0015] Shipping accident data is provided, and a large language model is used to extract shipping accident information and relationships between the shipping accident information from the shipping accident data, to construct an ontology model of the shipping accident information, and to input the ontology model into a shipping accident database to obtain the shipping accident knowledge graph.

[0016] Optionally, a large language model is used to extract shipping accident information and relationships between the shipping accident information from shipping accident data, to construct an ontology model of the shipping accident information, including:

[0017] According to the shipping accident information and the relationships between the shipping accident information, a large language model is used to supplement missing shipping accident elements.

[0018] Optionally, a large language model is used to analyze the problem and generate a query statement, including:

[0019] The large language model generates a first target field matching the shipping accident element type based on the user input question and the preset shipping accident element type, and generates a second target field matching the shipping accident information based on the user input question;

[0020] A first query statement is generated according to the first target field, and a second query statement is generated according to the second target field.

[0021] Optionally, the large language model generates a first target field matching the shipping accident element type based on the user input question and the preset shipping accident element type, including:

[0022] The large language model extracts a field matching the shipping accident element type from the question according to the preset shipping accident element type, and fills in a supplementary field for the missing field of the shipping accident element type;

[0023] The first target field is generated according to the matching field and the supplementary field.

[0024] Optionally, according to the query statement, a node and an edge matching the query statement are output from the shipping accident knowledge graph, and a Bayesian network is generated according to the matching node and edge, including:

[0025] The query statement is executed to query the shipping accident knowledge graph, target nodes matching the query statement are screened out in the shipping accident knowledge graph, at least one causal chain containing the target nodes is obtained by extending from the target nodes along the edges of the target nodes level by level, and a Bayesian network is generated according to the at least one causal chain.

[0026] Optionally, the at least one causal chain containing the target nodes is obtained by extending from the target nodes along the edges of the target nodes level by level, including:

[0027] The target node is marked as level 0, and the nodes are extended level by level from the target node, the level of the parent node is increased by 1 level every time the parent node is extended by 1 level, the level of the child node is reduced by 1 level every time the child node is extended by 1 level, and the at least one causal chain containing the target nodes is obtained according to the target node and the nodes extended from the target node until the end is reached.

[0028] Among the multiple same parent nodes, the highest level of the multiple same parent nodes is taken, and among the multiple same child nodes, the lowest level of the multiple same child nodes is taken.

[0029] Optionally, the large language model generates an answer according to the query result, including:

[0030] The first answer generated based on the first query statement, the second answer generated based on the second query statement, the first answer and the second answer are merged, and the content with low credibility in the first answer content and the second answer content is removed to generate the answer.

[0031] In a second aspect, an embodiment of a shipping accident analysis device is provided, and the device includes:

[0032] A data module is configured to store the constructed shipping accident knowledge graph.

[0033] A retrieval module is configured to input a question, analyze the question by using a large language model to generate a query statement, retrieve in the shipping accident knowledge graph according to the query statement, output nodes and edges matching the query statement from the shipping accident knowledge graph, generate a Bayesian network according to the matching nodes and edges, generate a query result according to the conditional probability of the target node and its parent node and / or the posterior probability of the target node and its child node in the Bayesian network, and input the query result into the large language model.

[0034] In a third aspect, an embodiment of a computer device is provided, and the computer device is configured to execute the shipping accident analysis method.

[0035] In a fourth aspect, an embodiment of a storage medium is provided, and the storage medium is configured to store a program executable for the shipping accident analysis method.

[0036] The technical solutions provided by the application have at least the following technical effects:

[0037] By using the Bayesian network analysis model to analyze the shipping accident data, the marginal probability and joint probability are calculated for the shipping accident information in the shipping accident data, the occurrence probability of the complete cause-effect chain from the cause to the accident result in the accident is obtained, and thus the objective and accurate accident cause-effect of the complex shipping accident is teased out, and reliable conclusion opinions are provided for subsequent shipping business. Meanwhile, in view of the problems that the shipping accident report is unstructured, the information is lengthy and there is interference, and the Bayesian network analysis model relies on structured data to construct a directed acyclic graph, the knowledge graph is used to store the shipping accident information of the shipping accident, the shipping accident knowledge graph containing nodes and edges is formed, the information is extracted from the knowledge graph by using a retrieval enhancement generation method, and the shipping accident elements having a direct correlation with the shipping accident are distinguished from the shipping accident information, so that the nodes and edges queried from the shipping accident knowledge graph are simply and efficiently extracted, and the directed acyclic graph is generated. Finally, in view of the problem that the shipping accident information is miscellaneous and easy to interfere with the Bayesian network model to generate an accurate answer, the user input question is analyzed, the fields related to the shipping accident elements are extracted to generate a first query statement, and the fields related to the shipping accident information are extracted to generate a second query statement, and then an answer is generated according to the first query statement and the second query statement, so as to overcome the possible errors in the answer generated by using a single query statement. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only show some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from the drawings shown without any creative labor.

[0039] Figure 1 A flowchart of a shipping accident analysis method in an embodiment;

[0040] Figure 2 A flowchart of a retrieval enhancement generation method for retrieving the shipping accident knowledge graph to generate an answer in an embodiment;

[0041] Figure 3 Shipping accident information in an embodiment;

[0042] Figure 4 A shipping accident ontology model in an embodiment;

[0043] Figure 5 A shipping accident knowledge graph in an embodiment;

[0044] The objectives, functional characteristics and advantages of the present application will be further explained in conjunction with the embodiments, with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application 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 only used to explain the present application and should not be used to limit the present application.

[0046] Shipping accidents are a major threat to the shipping industry. Past shipping accidents usually form shipping accident reports. By analyzing shipping accident reports, the causes of the accidents can be clarified, and preventive measures can be taken to avoid future shipping accidents. However, the number of shipping accident reports is large, and the content is long. Manual analysis of shipping accident reports is inefficient. Although large language models can overcome the problem of low efficiency of manual analysis, due to the complexity of shipping accident causes and the use of unstructured language in shipping accident reports, large language models have deviations in extracting shipping accident information from shipping accident reports and providing risk warnings for upcoming shipping based on the extracted shipping accident information, which further leads to the risk warning conclusion. Reliability is not as good as manual analysis.

[0047] To solve the above problems, the present embodiment provides a shipping accident analysis method. As shown in Figures 1-2 The method comprises the following steps:

[0048] S1, constructing a shipping accident knowledge graph;

[0049] S2, inputting a question, using a retrieval enhancement generation method to retrieve the shipping accident knowledge graph, and generating an answer;

[0050] Wherein, using the retrieval enhancement generation method to retrieve the shipping accident knowledge graph and generate an answer, comprising:

[0051] S201, using a large language model to analyze the question and generate a query statement;

[0052] S202, retrieving in the shipping accident knowledge graph according to the query statement, outputting the nodes and edges matched with the query statement from the shipping accident knowledge graph, and generating a Bayesian network according to the matched nodes and edges;

[0053] S203, generating a query result according to the conditional probability of the target node and its parent node in the Bayesian network and / or the posterior probability of the target node and its child node, and inputting the query result into the large language model;

[0054] S204, the large language model generates an answer according to the query result.

[0055] Wherein, the knowledge graph is a structured semantic knowledge base used to store and represent entities in reality and their mutual relationship; the large language model is an artificial intelligence model based on deep learning, which can understand and generate natural language through text training; the retrieval-enhanced generation method is a method combining information retrieval and large language model text generation, including the steps of retrieving relevant knowledge, constructing enhanced prompt words, and generating answers; the Bayesian network is a probabilistic graph model including directed acyclic graph and conditional probability, used to describe the probabilistic dependency relationship between random variables, and the Bayesian network analysis model is an analysis tool based on the Bayesian network; the causal chain refers to the progressive causal relationship between multiple random variables, which form a chain from cause to effect.

[0056] The embodiment pre-constructs a shipping accident knowledge graph containing shipping accident data, extracts relevant shipping accident information from the shipping accident knowledge graph using a retrieval-enhanced generation method, and forms an answer, greatly improving the accuracy of extracting accident information and the efficiency of analyzing accident reports; the Bayesian network analysis model is used to calculate the accident causality probability, and the complex shipping accident is converted into an explicit causal chain and causal probability, which eliminates the subjectivity and bias of manual analysis and improves the reliability of risk warning conclusions.

[0057] In one possible embodiment, the shipping accident knowledge graph is constructed, including:

[0058] Shipping accident data is provided, and a large language model is used to extract shipping accident information and the relationship between shipping accident information from the shipping accident data, construct an ontology model of shipping accident information, input the ontology model into a shipping accident database, and obtain a shipping accident knowledge graph.

[0059] Wherein, the shipping accident data refers to information that can reflect shipping accidents, including text, numbers, and pictures and any combination thereof; the shipping accident information refers to the structured fields obtained after the large language model extracts the shipping accident data; and the shipping accident ontology model refers to a model constructed according to the shipping accident information and its relationship.

[0060] In one possible embodiment, the large language model includes a DeepSeek-R1 model.

[0061] Specifically, the large language model learns knowledge through pre-validation.

[0062] Specifically, the pre-validation knowledge includes professional terms and fixed appellations in the shipping field, such as known ship types, port names, and water area names.

[0063] The shipping accident data is usually expressed in natural language and field-specific terms, and the unstructured characteristics of the words are obvious. It is difficult for a large language model to efficiently and accurately extract information from such unstructured data and generate structured shipping accident information. To solve the above problems, the embodiment adopts a pre-verified knowledge learning method to import pre-verified knowledge to the large language model, so that the large model can accurately extract shipping accident information from the shipping accident report according to the prompt word, thereby improving the efficiency and accuracy of shipping accident information extraction.

[0064] In a possible embodiment, the shipping accident data includes a shipping accident report.

[0065] The shipping accident report is used to embody shipping accident information. For the category of shipping business, shipping accident reports sufficient to cover the business category can be selected to construct a shipping accident knowledge graph. For domestic shipping business, shipping accident reports published by the China Maritime Safety Administration can be selected to construct a shipping accident knowledge graph.

[0066] In a possible embodiment, the shipping accident information includes ship information, accident information, investigation information, and environmental information, as shown in Figure 3

[0067] Optionally, the ship information includes ship basic information, ship construction information, technical parameters, safety information, operation information, and power system.

[0068] Optionally, the accident information includes accident type, accident name, accident area, accident time, accident process, and loss situation.

[0069] Optionally, the investigation information includes investigation unit, investigation time, responsibility identification, and safety management suggestion.

[0070] Optionally, the environmental information includes day and night information, weather conditions, and navigation environment.

[0071] Optionally, the relationship between the shipping accident information is confirmed by a statement in the shipping accident data that represents the mutual association between the shipping accident information. Such statements include "occurred in", "due to", "resulted in", "belong to", etc. It is determined that there is a relationship between the shipping accident information before and after the statement.

[0072] Optionally, a model shipping accident ontology model is constructed according to the shipping accident information and its relationship, as shown in Figure 4

[0073] The shipping accident ontology model includes a table.

[0074] ​​Shipping accident data, especially shipping accident reports, often contain a large amount of text, numbers and pictures unrelated to the basic information of the accident. By capturing shipping accident information and the relationship between shipping accident information, a shipping accident ontology model can be constructed to convert lengthy reports into a concise and clear shipping accident ontology model with clear levels, thereby facilitating the construction of a shipping accident knowledge graph.

[0075] In some cases, due to the lack of a unified format for shipping accident reports, different shipping accident reports disclose different types of shipping accident information, which may result in the absence of some types of shipping accident information in some shipping accident reports. When a large language model is used to extract shipping accident information from shipping accident reports, the missing shipping accident information types will result in an incomplete shipping accident ontology model, affecting the construction of a knowledge graph and shipping accident analysis.

[0076] For example, a ship collision accident caused by poor visibility during night navigation, the report may only record that the collision was caused by the negligence of the duty officer, without recording the environmental information of night navigation. Therefore, the shipping accident information extracted by the large language model from the shipping accident report will not include the environmental information related to night navigation. When the user asks about night navigation, the large language model cannot extract the causal chain of the above shipping accident, which may result in inaccurate subsequent analysis and give incorrect risk warning conclusions.

[0077] To solve the above problems, in one embodiment, a large language model is used to extract shipping accident information and the relationship between shipping accident information from shipping accident data, and construct an ontology model of shipping accident information, which further includes:

[0078] According to the shipping accident information and the relationship between the shipping accident information, a large language model is used to supplement the missing shipping accident elements.

[0079] Specifically, the types of shipping accident elements include: ship basic information, accident information and environmental information.

[0080] Shipping accident elements refer to shipping accident information directly related to the cause of the accident. Ship basic information is used to reflect the operation of the ship during the accident process. Accident information is used to reflect the identification of the accident by the shipping accident report. Environmental information is used to reflect the meteorological conditions of the ship during the accident process.

[0081] By clearly defining shipping accident information, the causal relationship of shipping accident occurrence can be more accurately locked.

[0082] Supplementing missing shipping accident elements using a large language model includes: using shipping accident data to infer missing shipping accident elements, and searching external databases for missing shipping accident elements.

[0083] For example, for the aforementioned shipping accident report, in addition to structuring it and extracting shipping accident elements, the large language model finds that the report does not record the weather conditions at the time of the accident. The large language model first infers that the accident occurred during the day or night according to the specific time of the accident recorded in the report, and supplements the day and night information in the environmental information element of the shipping accident; then the large language model retrieves the weather at the location on that day from a reliable external database according to the time and location of the accident, and supplements the weather conditions in the environmental information element of the shipping accident. In this way, when the user asks about the risk of sailing through a certain water area at night, the large language model will structure the user's question and identify the shipping accident elements including night sailing, and then accurately extract the aforementioned shipping accident data from the knowledge graph.

[0084] In one possible embodiment, the shipping accident knowledge graph includes a shipping accident knowledge graph based on a Neo4j graph database.

[0085] In which, after the large language model extracts the shipping accident information, the shipping accident information is stored in a CVS format file, and the CVS format file storing the shipping accident information is converted into a Neo4j graph database to obtain a shipping accident knowledge graph based on a Neo4j graph database.

[0086] Specifically, converting the CVS format file storing the shipping accident information into a Neo4j graph database includes traversing the CVS format file storing the shipping accident information, filtering out invalid values, storing shipping accident information of the same type into a set and de-duplicating, subsequently establishing relationships between shipping accident information of different types, calling a de-duplication function to ensure that each group of relationships is unique, then using a py2neo database to connect the above set to a Neo4j database, and for each shipping accident information and the relationship between the shipping accident information, creating corresponding nodes and edges in the Neo4j database, thereby obtaining a shipping accident knowledge graph based on a Neo4j graph database.

[0087] Shipping accidents are complex, and shipping accident data varies in complexity. Although traditional relational databases can store shipping accident information, they are difficult to fully and accurately express the relationships between shipping accident information, especially causal relationships. Neo4j graph database expresses shipping accident information in a graphical structure, which can clearly and intuitively display the complex relationships between shipping accident information, and also facilitates subsequent retrieval and query.

[0088] In one possible embodiment, the input question includes a structured language question.

[0089] Specifically, the structured language question includes checking the question in a plurality of predetermined questions in the interactive interface.

[0090] In a possible embodiment, the input question includes a question in unstructured language.

[0091] Specifically, the question in unstructured language can include a question in the form of inputting a text dialog box in natural language, or a question in the form of voice conversation in natural language.

[0092] By expanding the input form of the question, the convenience of the user interaction link can be improved.

[0093] In a possible embodiment, a large language model is used to analyze the question and generate a query statement, including:

[0094] The large language model extracts a target field matched with the shipping accident information from the question, and generates a query statement according to the target field.

[0095] When the user only queries the shipping accident that has occurred in the past, the question input by the user usually contains content closely related to the shipping accident to be queried. At this time, the large language model extracts a target field matched with the shipping accident information from the question, and generates a query statement according to the target field, so that the query statement can be efficiently generated.

[0096] Generally, the query statement includes multiple fields related to the shipping accident information, but the fields have different degrees of association with the accident, which may affect the accuracy of the subsequent risk warning. For example, when the user asks about the risk of a certain type of ship passing through a certain water area on a certain day, the large language model will extract related accident information in the knowledge graph according to the ship type, date, and water area. The data thus extracted will include other irrelevant accidents of the water area involved in the question, and thus an incorrect risk warning conclusion will be given.

[0097] To solve the problem, in a possible embodiment, a large language model is used to analyze the question and generate a query statement, including:

[0098] The large language model extracts a first target field matched with a shipping accident element type from the question according to a preset shipping accident element type; and the large language model extracts a second target field matched with the shipping accident information from the question.

[0099] A first query statement is generated according to the first target field, and a second query statement is generated according to the second target field.

[0100] Shipping accident elements are a type of shipping accident information that is more closely related to the occurrence of an accident. Identifying shipping accident elements helps to exclude the interference of other shipping accident information on the analysis results. In this embodiment, the shipping accident information involved in the question is analyzed according to the pre-set shipping accident element type, and the first target field that matches the shipping accident element type is extracted while the second target field that matches the shipping accident information is retained. In this way, on the one hand, the cause of the shipping accident can be accurately locked from the shipping accident, and the shipping accident information that is not directly related to the accident can be excluded. On the other hand, the content in the user's question is still extracted completely, avoiding omission in subsequent analysis.

[0101] In some cases, the user's input question may be incomplete. For example, in the shipping risk warning scenario, weather conditions are an important reference factor for shipping accident risk warning. However, users generally do not voluntarily disclose weather conditions when asking for risk warning opinions. For example, when a user wants to evaluate the risk of a ship passing through a certain water area on a certain day, the user usually only states the date, water area, and ship type in the question when asking in natural language, but does not voluntarily query the weather in the water area on that date as a question input. This results in an overemphasis on shipping accident elements associated with the water area when searching for shipping accident elements from the knowledge graph. On the one hand, this cannot include past shipping accidents with weather conditions in the causal chain. On the other hand, it also includes other unrelated shipping accidents that occur in the water area in the causal chain. This further causes the probability calculated by the Bayesian network analysis model to deviate and gives an incorrect risk warning conclusion. For another example, ship aging is an important factor that leads to shipping accidents. However, users rarely voluntarily disclose the age of the ship, and large language models also cannot identify the age of the ship from the user's question. This also makes it difficult to include the age of the ship in the causal chain when searching for shipping accident elements from the knowledge graph, further weakening the reliability of the risk warning conclusion.

[0102] To solve the above problems, in one possible embodiment, the large language model generates a first target field that matches the shipping accident element type based on the user input question and the pre-set shipping accident element type, including:

[0103] The large language model extracts a field that matches the shipping accident element type from the question according to the pre-set shipping accident element type, and fills in a supplementary field for the missing field of the shipping accident element type;

[0104] The first target field is generated according to the matched field and the supplementary field.

[0105] Optionally, the shipping accident element type includes ship basic information, accident information, and environmental information.

[0106] Among them, the shipping accident element type for the missing field is filled in the supplementary field, including:

[0107] The large language model is used to search the reliable external database, and the search results are filled in the supplementary field. For the shipping accident element type that is still missing, the user is prompted to input the supplementary field.

[0108] Specifically, when the large language model analyzes the question, it will decompose the question based on the preset shipping accident element type, and identify the first target field corresponding to the shipping accident element type. For the shipping accident element type with missing fields, the large language model will first search in the reliable external database to supplement the missing shipping accident elements; then for the still missing shipping accident elements, the user is prompted to input the supplementary field; if the user inputs the supplementary field, the shipping accident element type is completed, and the query statement is generated accordingly; if the user does not input the supplementary field, the corresponding query statement is generated based on the existing target field.

[0109] For example, other target shipping accident elements include weather factors and ship age factors. When the user asks about the risk of a ship transporting goods through a certain water area on a certain day, the large language model will structure the user's question and identify the shipping time, water area, and shipping goods fields. The large language model traverses the shipping accident element type, identifies the shipping time and water area as basic elements of the shipping accident, and identifies the missing weather conditions and ship basic information. For weather conditions and ship basic information, the large language model will first search in the reliable external database, and then query the corresponding weather conditions through the date and water area in the question and generate the supplementary field. For ship basic information, the large language model cannot be queried through the reliable external database, so the user is prompted to supplement it. When the user supplements the ship basic information, the large language model generates a supplementary field based on the user's supplementary information, and then generates a corresponding query statement according to the first target field after supplementation.

[0110] Through the above method, the embodiment can divide the content of the user input question according to the relevance to the shipping accident, and supplement the missing content, providing strong data support for subsequent Bayesian network analysis.

[0111] In one embodiment, the query statement is used to execute the query of the shipping accident knowledge graph. For the shipping accident knowledge graph based on the Neo4j graph database, the query statement includes a Cypher statement.

[0112] In one embodiment, the large language model is prompted by a prompt word.

[0113] Among them, the prompt word learning includes importing a prompt word template into the large language model.

[0114] Specifically, the prompt word template includes a role setting, a question and answer background, and an answer requirement, such as the role setting being a shipping accident analysis expert, the question and answer background being to evaluate the possibility of a shipping accident risk, and the answer requirement including giving a risk evaluation conclusion and suggestion.

[0115] The shipping accident data is usually expressed in natural language and domain-specific terminology, and the unstructured characteristics of the words are obvious. It is difficult for a large language model to efficiently and accurately extract information from such unstructured data and generate structured shipping accident information. To solve the above problems, the embodiment uses the prompt word learning method to import the prompt word template to the large language model, so that the large model can accurately generate the answers required by the user according to the prompt words.

[0116] Generally, the question input by the user is in natural language. Since the shipping field involves professional terms and fixed appellations, the large language model can easily extract incorrect information from the natural language question. Therefore, the embodiment pre-sets prompt word learning for the large language model. Through the preset prompt word learning of the large language model, the large language model can accurately extract the query target and retrieval prompt according to the prompt words when facing the natural language question, and convert it into a query statement through semantic completion of the question.

[0117] In one possible embodiment, according to the query statement, the nodes and edges matched with the query statement are output from the shipping accident knowledge graph, and a Bayesian network is generated according to the matched nodes and edges, including:

[0118] The query statement is executed to query the shipping accident knowledge graph, the target node matched with the query statement is filtered out in the shipping accident knowledge graph, the target node is extended along the edges of the target node, at least one causal chain containing the target node is obtained, and a Bayesian network is generated according to the at least one causal chain.

[0119] In one possible embodiment, the target node is extended along the edges of the target node, at least one causal chain containing the target node is obtained, including:

[0120] The target node is marked as level 0, and the target node is extended level by level. When extending to a parent node, the level of the parent node is increased by 1, and when extending to a child node, the level of the child node is decreased by 1, until the end is reached. According to the target node and the nodes extended from the target node, at least one causal chain containing the target node is obtained.

[0121] By marking the depth value of the node, the causal relationship between the nodes can be ensured to be in the form of cause above and result below, which not only facilitates the integration of the causal chains into the Bayesian network, but also conforms to the logic of human cognition.

[0122] Since there is no fixed template for shipping accident reports, different shipping accident reports have different habits of recording the causes of accidents, which may cause some shipping accident reports to miss some accident cause links. For example, for the cause-effect chain of "driver fatigue - ignoring the oncoming ship - collision accident", it may be omitted as "driver fatigue - collision accident" in some shipping accident reports, which may cause the same accident cause to be assigned multiple different levels in different shipping accident reports. The Bayesian network generated in this way does not conform to the logic of human cognition and is not conducive to the accurate analysis of the Bayesian network analysis model.

[0123] To solve the above problem, in one possible embodiment, the target node is marked as level 0, and the extension is performed from the target node to the parent node and the child node. When extending to a parent node, the level of the parent node is increased by 1; when extending to a child node, the level of the child node is decreased by 1, until the end is reached. In addition, the following steps are also included:

[0124] For multiple same parent nodes in the parent nodes, the highest level in the multiple same parent nodes is taken; for multiple same child nodes in the child nodes, the lowest level in the multiple same child nodes is taken.

[0125] Through the above method, the embodiment unifies the levels of the same nodes, avoiding the problem that the same nodes are assigned multiple levels.

[0126] In one possible embodiment, the query result is generated according to the conditional probability of the target node and its parent nodes in the Bayesian network and / or the posterior probability of the target node and its child nodes, including:

[0127] The Bayesian network analysis model is used to calculate the conditional probability and the posterior probability of adjacent nodes in the Bayesian network, and to calculate the joint conditional probability and / or the joint posterior probability of the cause-effect chain. According to the joint conditional probability and / or the joint posterior probability chain, the target cause-effect chain is screened, and the corresponding shipping accident information and the relationship between the shipping accident information are output according to the nodes in the target cause-effect chain, to form the query result.

[0128] The Bayesian network composed of at least one cause-effect chain is a directed acyclic graph.

[0129] Since the Bayesian network analysis model is only applicable to the scenario of directed acyclic graph, in order to use the Bayesian network analysis model, a corresponding directed acyclic graph needs to be constructed for the target node in the shipping accident knowledge graph. The embodiment extracts the cause-effect chain containing the target node, and combines the cause-effect chain into a directed acyclic Bayesian network, which can be used for the calculation of conditional probability and / or posterior probability by the Bayesian network analysis model.

[0130] The conditional probability is used to represent the occurrence probability of the target node under the premise that its parent node occurs.

[0131] wherein the posterior is used to express the probability of the target node occurring given the premise of its child nodes.

[0132] wherein the joint conditional probability is used to express the probability of the target node occurring given the premise of its multi-level parent nodes.

[0133] wherein the joint posterior is used to express the probability of the target node occurring given the premise of its multi-level child nodes.

[0134] By calculating the joint conditional probability and / or the joint posterior probability, the causes and / or results of the shipping accident information corresponding to the target node can be evaluated, and a shipping warning related to the shipping accident information can be given.

[0135] Shipping accidents are usually complex in causes, and a shipping accident knowledge graph cannot well express how shipping accident information with complex causes and effects is related to each other. The embodiment introduces a Bayesian network analysis model, and by calculating the joint conditional probability and / or the joint posterior probability of the shipping accident information, the causes and / or results of the accident factors are quantitatively analyzed, which helps to clarify the causes and results of complex shipping accident information and improve the reliability of shipping warning.

[0136] In one possible embodiment, the large language model generates an answer according to a query result, including:

[0137] generating a first answer based on a first query statement, generating a second answer based on a second query statement, merging the first answer and the second answer, and removing low-confidence content in the first answer and the second answer to generate an answer.

[0138] When a user asks a question in natural language, some fields that affect shipping accident analysis may be omitted in the question, and some fields that interfere with shipping accident analysis may be included. By filtering fields related to shipping accident element types from the question to generate a first query statement and a first answer, and filtering fields related to shipping accident information from the question to generate a second query statement and a second answer, multiple answers can be obtained without using multiple large language models or multiple data sources, and a more reliable and accurate answer can be generated according to the multiple answers.

[0139] In one embodiment, removing low-confidence content in the first answer and the second answer includes replacing low-confidence answer content with high-confidence answer content; for example, for factual questions with only one correct answer, when the first answer content and the second answer content contradict each other, the corresponding content of the first answer is replaced with the content of the first answer.

[0140] In an embodiment, the content with low credibility in the first answer and the second answer is removed, including accumulating the content with low credibility in the second answer to the content with high credibility in the first answer; for example, for a question related to quantity statistics, when the quantity of statistics in the first answer and the quantity of statistics in the second answer are different, the quantity of statistics in the second answer can be considered to be accumulated to the quantity of statistics in the first answer after being de-duplicated, so as to form more complete data statistics.

[0141] Optionally, the credibility of the answer includes a confidence score of the answer.

[0142] Optionally, it is determined that the credibility of the first answer is higher than the second answer.

[0143] In the embodiment, since the first answer is generated based on the first query statement with higher relevance to the shipping accident, a simple and efficient method is to determine that the credibility of the first answer is higher than the second answer.

[0144] Optionally, the answer includes a structured template.

[0145] The structured template includes at least one of an accident name, an accident time, an accident location, a ship type, weather, an accident cause, and an accident result.

[0146] Optionally, the answer includes a natural language answer.

[0147] The query result is input into a large language model, and one or more of historical answer records and knowledge base texts are combined to form a semantically complete context to answer in unstructured natural language.

[0148] Optionally, the answer includes a picture.

[0149] The picture includes a map generated by calling a map component.

[0150] The picture also includes a knowledge graph.

[0151] The application also provides an embodiment of a shipping accident analysis device, which comprises:

[0152] A data module for storing a constructed shipping accident knowledge graph.

[0153] A retrieval module for inputting a question, retrieving the shipping accident knowledge graph by using a retrieval enhancement generation method, and generating an answer.

[0154] The retrieval module retrieves the shipping accident knowledge graph by using the retrieval enhancement generation method to generate an answer, including:

[0155] A large language model is used to analyze the question to generate a query statement.

[0156] finding a target node in the shipping accident knowledge graph according to the query statement, and outputting at least one cause-effect chain containing the target node in the shipping accident knowledge graph;

[0157] calculating the conditional probability of the target node and its parent node and / or the posterior probability of the target node and its child node in the cause-effect chain by using a Bayesian network analysis model, and outputting the query result according to the conditional probability and / or the posterior probability;

[0158] generating an answer according to the query result.

[0159] The application also provides an embodiment of a computer device for executing the shipping accident analysis method.

[0160] The application also provides an embodiment of a storage medium for storing a program executable for the shipping accident analysis method.

[0161] The application also provides an embodiment of a shipping accident analysis method for a specific application scenario, comprising:

[0162] S1, constructing a shipping accident knowledge graph;

[0163] The collision accident reports disclosed by the China Maritime Safety Administration are taken as shipping accident data, and the DeepSeek-R1 model is used to extract shipping accident information and the relationship between the shipping accident information from the shipping accident data, wherein the shipping accident information includes “accident name”, “accident location”, “occurrence time”, “ship name”, “weather condition”, “accident type”, “personnel casualty”, “property loss”, “responsibility determination”, and “post-accident follow-up”; the relationship between the shipping accident information is determined according to the sentences representing the mutual correlation between the shipping accident information in the shipping accident data, such as “occurred in”, “due to”, “led to”, “belong to”, etc., to determine that there is a relationship between the shipping accident information before and after the sentence. The shipping accident information and the relationship between the shipping accident information are stored in a dual structure of a vector database and a Neo4j graph database. The shipping accident knowledge graph containing part of the shipping accident information is as shown in Figure 5 .

[0164] S2, analyzing the question by using a large language model to generate a query statement;

[0165] A user inputs a natural language question, for example, asking “Will collision occur in fog navigation?” The DeepSeek-R1 model accepts the input, combines the prompt word template, accident graph content, and ontology structure, calls the pre-trained language model to perform semantic completion on the question, and generates a query target and retrieval prompt including “fog navigation” and “collision”. The deepseek_generate(prompt, files) method is called to generate a Cypher query statement based on the preset prompt word system information, combined with graph attribute definitions, relationship definitions, and other structured information.

[0166] S3, according to the query statement in the shipping accident knowledge graph, the nodes and edges matched with the query statement are output from the shipping accident knowledge graph, and the Bayesian network is generated according to the matched nodes and edges;

[0167] The Cypher query statement is executed in the shipping accident knowledge graph of the Neo4j database, and the execute_and_visualize_query(query) method is called. All shipping accident information and relationships between shipping accident information matched with the Cypher query statement are extracted from the shipping accident knowledge graph to form Bayesian networks containing “fog navigation”, “collision” and the relationships between the above shipping accident information.

[0168] S4, according to the conditional probability of the target node and its parent node and / or the posterior probability of the target node and its child node in the Bayesian network, the query result is generated, and the query result is input into the large language model;

[0169] The conditional probability of each chain in the Bayesian network is calculated, and the corresponding shipping accident information and the relationship between the shipping accident information are output as the query result, and the query result is sent to the DeepSeek-R1 model.

[0170] S5, the large language model generates an answer according to the query result;

[0171] For the query result, the DeepSeek-R1 model enables context enhancement, combines historical answers and knowledge base texts to form a complete context. The model returns a natural language answer “The probability of collision in fog navigation is high”, and the system organizes a structured output template and calls a map component to generate an answer map.

[0172] The application also provides an embodiment for showing the accuracy of the shipping accident analysis method of the application and the large language model analysis method in analyzing shipping accidents, including:

[0173] Six groups of data sets are constructed, each of which includes 50 different shipping accident reports, and four questions related to the number of accident items are prepared for each data set, including accident location, time, weather, as shown in Table 1:

[0174]

[0175] Table 1: Data sets and questions

[0176] For each data set, the knowledge graph is constructed using the shipping accident analysis method of the present application, and the DeepSeek-R1 model is accessed, then the corresponding questions of each data set are asked, and the answers are collected and compared with the correct answers, and the accuracy of the answers is calculated according to the number of accident items divided by the number of correct accident items, and the results are shown in Table 2:

[0177]

[0178] Table 2: Accuracy of Deepseek-R1 model and the method of the present application in answering questions

[0179] It can be seen that the system performs significantly better than DeepSeek in terms of accuracy, and can provide more accurate and targeted answers, fully embodying the advantages of domain knowledge enhancement and structured support in intelligent question answering, and providing more reliable intelligent assistance for shipping safety management in complex scenarios.

[0180] The device embodiments described above are only illustrative, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0181] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, server, or network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0182] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit the same; and although the present application has been described in detail with reference to the foregoing embodiments, it should be appreciated by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features thereof can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of maritime incident analysis, characterized by, The method comprises the following steps: constructing a shipping accident knowledge graph; inputting a question, searching the shipping accident knowledge graph by using a search-enhanced generation method, and generating an answer; wherein the search-enhanced generation method is used to search the shipping accident knowledge graph and generate an answer, comprising: using a large language model to analyze the question and generate a query statement; searching in the shipping accident knowledge graph according to the query statement, outputting nodes and edges matching the query statement from the shipping accident knowledge graph, and generating a Bayesian network according to the matching nodes and edges; generating a query result according to the conditional probability of the target node and its parent node and / or the posterior probability of the target node and its child node in the Bayesian network, and inputting the query result into the large language model; the large language model generates an answer according to the query result; wherein the large language model analyzes the question and generates a query statement, comprising: the large language model generates a first target field matching the shipping accident element type based on the user input question and the preset shipping accident element type, and generates a second target field matching the shipping accident information based on the user input question; generating a first query statement according to the first target field, and generating a second query statement according to the second target field.

2. The method of maritime incident analysis of claim 1, wherein, constructing the shipping accident knowledge graph, comprising: providing shipping accident data, extracting shipping accident information and the relationship between the shipping accident information from the shipping accident data by using the large language model, constructing an ontology model of the shipping accident information, inputting the ontology model into a shipping accident database, and obtaining the shipping accident knowledge graph.

3. The method of maritime incident analysis of claim 2, wherein, extracting shipping accident information and the relationship between the shipping accident information from the shipping accident data by using the large language model, constructing an ontology model of the shipping accident information, comprising: complementing missing shipping accident elements by using a large language model based on the shipping accident information and the relationship between the shipping accident information.

4. The method of maritime incident analysis of claim 1, wherein, the large language model generates a first target field matching the shipping accident element type based on the user input question and the preset shipping accident element type, comprising: the large language model extracts a field matching the shipping accident element type from the question according to the preset shipping accident element type, and fills in a complementary field for the missing field of the shipping accident element type; generating the first target field according to the matching field and the complementary field.

5. The method of maritime incident analysis of claim 4, wherein, searching in the shipping accident knowledge graph according to the query statement, outputting nodes and edges matching the query statement from the shipping accident knowledge graph, and generating a Bayesian network according to the matching nodes and edges, comprising: The query statement is executed to query the shipping accident knowledge graph, target nodes matching the query statement are screened out in the shipping accident knowledge graph, at least one causal chain containing the target nodes is obtained by extending from the target nodes along the edges of the target nodes, and the Bayesian network is generated according to the at least one causal chain.

6. The method of maritime incident analysis of claim 1, wherein, The large language model generates an answer according to the query result. The first answer generated based on the first query statement and the second answer generated based on the second query statement are merged, and the contents with low credibility in the first answer content and the second answer content are removed to generate the answer.

7. A shipping incident analysis apparatus characterized by comprising: It comprises: a data module for storing the constructed shipping accident knowledge graph; a retrieval module for inputting a question, analyzing the question by using a large language model to generate a query statement, retrieving in the shipping accident knowledge graph according to the query statement, outputting nodes and edges matching the query statement from the shipping accident knowledge graph, generating a Bayesian network according to the matching nodes and edges, generating a query result according to the conditional probability of the target node and its parent node and / or the posterior probability of the target node and its child node in the Bayesian network, and inputting the query result into the large language model; the large language model generates an answer according to the query result; wherein the large language model analyzes the question to generate a query statement, comprising: the large language model generates a first target field matching the shipping accident element type based on the user input question and the preset shipping accident element type; and the large language model generates a second target field matching the shipping accident information based on the user input question; a first query statement is generated according to the first target field, and a second query statement is generated according to the second target field.

8. A computer device for executing the shipping accident analysis method of any one of claims 1-6.

9. A storage medium for storing a program executable for the shipping accident analysis method of any one of claims 1-6.

Citation Information

Patent Citations

  • Maritime accident assisting method and device based on knowledge graph and electronic equipment

    CN116860984A

  • Foundation pit construction accident knowledge graph construction method based on text mining

    CN119202264A