A method for constructing domain ontology

By building a domain ontology through multiple public large models and using directed graph merging algorithm and confidence assessment, the problem of inaccurate top-level concept selection in top-down construction is solved, and high accuracy and consistency of domain ontology construction are achieved.

CN120045710BActive Publication Date: 2025-09-19LESHAN NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510166337.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-09-19
Estimated Expiration
2045-02-14

AI Technical Summary

Technical Problem

In the existing technology, the top-down construction of domain ontology relies on the subjective judgment of domain experts, resulting in inaccurate or incomplete selection of top-level concepts, which affects the accuracy and completeness of ontology construction.

Method used

We use multiple public large models to build domain ontology, design prompt words for query, parse feedback text to build candidate ontology graph, use directed graph merging algorithm to integrate knowledge, perform confidence assessment, and select nodes and edges with high confidence to build the final ontology graph.

Benefits of technology

Effectively integrate the knowledge capabilities of multiple large models, avoid knowledge and axiomatic errors, improve the accuracy and consistency of domain ontology, and reduce dependence on domain experts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045710B_ABST
    Figure CN120045710B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing a domain ontology, which relates to the field of natural language processing technology. The method comprises: obtaining prompt words and querying them in user interfaces provided by multiple public large models to obtain a domain ontology feedback text set; performing text parsing on each feedback text in the domain ontology feedback text set to obtain domain concepts, relationships, and attribute vocabulary in the text; constructing a domain candidate ontology graph with domain concepts and attribute vocabulary as nodes, and relationships between domain concepts and relationships between domain concepts and attribute vocabulary as edges to obtain a domain candidate ontology graph set; merging the updated nodes and edges into an initialized empty graph with weights to obtain a domain candidate ontology graph; performing confidence assessment on the domain candidate ontology graph, selecting nodes and edges in the graph with confidence greater than a set threshold, and obtaining a final domain ontology graph. The present invention can fully integrate the knowledge capabilities of multiple different public large models without the need to introduce domain expert knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a method for constructing a domain ontology. Background Art

[0002] An ontology is a standardized, formalized description of objective things. Constructing a domain-specific ontology helps capture and describe knowledge in that domain, providing a common understanding of that knowledge and facilitating its sharing and reuse. With the development and application of knowledge graphs, ontology, as part of the core knowledge graph architecture, has garnered widespread attention. The goal of constructing a domain ontology is to identify the entity types and attributes within the domain knowledge system, as well as their hierarchical structure and relationships, thereby providing a standardized semantic framework for organizing domain knowledge.

[0003] At present, the main approach to constructing domain ontology is from top to bottom. The specific implementation includes: first, led by a team of experts with deep domain knowledge, starting from a macro perspective, the core concepts and top-level classifications of the domain are defined to form the basic framework of the ontology; following this top-level architecture, the conceptual system is gradually refined, and through consulting a large amount of literature, data, and expert interviews, each sub-concept, attribute, and the complex relationships between them are deeply explored and defined; in order to ensure the accuracy and practicality of the ontology, internal reviews and external verifications are also carried out regularly; after multiple rounds of iteration and improvement, a domain ontology with a clear structure, rich content, and the ability to fully reflect the characteristics of the domain is constructed.

[0004] The starting point of top-down construction of domain ontology is to determine the top-level concepts, which often relies on the subjective judgment and experience of domain experts, resulting in inaccurate or incomplete selection of top-level concepts, affecting the accuracy and completeness of subsequent ontology construction. Summary of the Invention

[0005] Based on this, it is necessary to provide a domain ontology construction method to address the above technical issues.

[0006] An embodiment of the present invention provides a method for constructing a domain ontology, including:

[0007] Get the prompt word Prompt for domain ontology construction;

[0008] The prompt word Prompt is used as the query text to query in the user interface provided by multiple public large models, and a domain ontology feedback text set Responses consisting of the feedback text output by each large model is obtained; wherein the multiple public large models are represented as: LLMs = {m1, m2, ... m i ,...,m K}, K is the total number of public large models, m iis the i-th public model; the domain ontology feedback text set is specifically Responses = {res1,res2,...res i ,...,res K},res i The feedback text output by the i-th public model;

[0009] Perform text parsing on each feedback text in the domain ontology feedback text set Responses to obtain the domain concepts, relationships, and attribute words in the text; construct the domain candidate ontology graph canGraph with domain concepts and attribute words as nodes, and the relationships between domain concepts and the relationships between domain concepts and attribute words as edges. i , get the domain candidate ontology graph set CanGraphs;

[0010] Update the duplication and weight of each node and each edge in the domain candidate ontology graph set CanGraphs, and use the directed graph merging algorithm combined with similarity to merge the updated nodes and edges into the initialized weighted empty graph to obtain the domain candidate ontology graph MergedGraph;

[0011] The confidence of the candidate domain ontology graph MergedGraph is evaluated, and the nodes and edges in the graph with confidence greater than the set threshold are selected to obtain the final domain ontology graph OntologyGraph.

[0012] Optionally, obtain the prompt word Prompt for domain ontology construction, including:

[0013] The domain ontology construction task is decomposed into three information extraction subtasks including concept classification, relationship classification and attribute classification;

[0014] Design output templates for the three information extraction subtasks respectively;

[0015] Select multiple public large models, test the output of each public large model and fine-tune the prompt words, and select K large models that are available and have domain knowledge LLMs = {m1,m2,...m i ,...,m K};

[0016] The prompt word Prompt is determined based on the output template of the information extraction subtask and the large model set.

[0017] Optionally, construct the domain candidate ontology graph canGraph i , specifically including:

[0018] For each text res in Responses in turn i Perform text parsing to get text resi The concept set contained in concepts i , attribute collection attributes i and relations i ;

[0019] According to the concept set concepts i , attribute collection attributes i and relations i , build text res i Corresponding domain candidate ontology graph canGraph i ;

[0020] Add the domain candidate ontology graph to the domain candidate ontology graph collection CanGraphs.

[0021] Optionally, for each text res in Responses in turn i Perform text parsing, including:

[0022] Initialize the concept set concepts i , attribute collection attributes i and relations i is an empty set;

[0023] Scan the text res in sequence i Each row in resSentence i,j , judge resSentence according to the output template ij The type includes concept classification, relationship classification or attribute classification;

[0024] If resSentence i,j Belong to the concept classification output template, then initialize the concept vocabulary set tmpConcepts to an empty set, and extract resentence according to the output template i,j The concept words in the text are added to the set tmpConcepts; each concept word tmpConcepts in the concept word set tmpConcepts is scanned in turn t , in the concept set concepts i Find each word in tmpConcepts t If it does not exist, the word tmpConcepts t Add to concepts collection concepts i; Take the first concept word tmpConcepts1 in the concept word set tmpConcepts as the main body, and all the remaining concept words tmpConcepts t For the object, the predicate or relation type is include, respectively forming a relation triple and adding it to the relation set relations i ;

[0025] If resSentence i,j If it belongs to the relation classification output template, the relation set tmpRelations is initialized to an empty set, and resSentence is extracted according to the output template. ij The relationship name relName and several relationship pairs in the text are added to the set tmpRelations; the relationship set tmpRelations is scanned in sequence, and each relationship pair tmpRelations in the set is t The two concept words tmpConcept1 and tmpConcept2 are subject and object respectively, and the predicate or relation type is relName, forming a relation triple and adding it to the relation set relations. i ;

[0026] If resSentence i,j Belongs to the attribute classification output template, then initialize the attribute set tmpAttributes to an empty set, and extract resentence according to the output template ij The concept word conName and all attribute words in the text are added to the set tmpAttributes; each attribute word tmpAttributes in the attribute word set tmpAttributes is scanned in turn t , the vocabulary tmpAttributes t Add to the attribute node collection attributes i ;

[0027] Scan each attribute vocabulary tmpAttributes in the attribute vocabulary set tmpAttributes in turn t , with the concept vocabulary conName as the main body and the attribute vocabulary tmpAttributes t The object, predicate or relation type is hasAttribute, respectively constitute a relation triple and add it to the relation set relations i ;

[0028] Repeat the iteration until the text res i Until all text lines in the are processed.

[0029] Optionally, construct the text res i Corresponding domain candidate ontology graph canGraph i , specifically including:

[0030] Initialize the domain candidate ontology graph canGraph i Empty graph, node set nodes i and edge sets edges i are all empty sets;

[0031] Scanning concept set concepts i Each concept in concepts i,j , in the domain candidate ontology graph canGraph i The node set nodes i Add a node with the label concepts i,j , type is conType;

[0032] Scan attribute collection attributes i Each attribute in attributes i,j , in the domain candidate ontology graph canGraph i The node set nodes i Add a node with the label attributes i,j , type is attType;

[0033] Scan the relationship collection relations i Each relationship in i,j , let the corresponding relation triple be<head,relType,tail> , respectively in the graph canGraph i Find the concept nodes or attribute nodes headNode and tailNode corresponding to head and tail in the domain candidate ontology graph canGraph i The edge set edges i Add a directed edge from headNode to tailNode with the edge type of relType.

[0034] Optionally, a candidate domain ontology graph MergedGraph is obtained, specifically including:

[0035] Initialize the weighted domain candidate ontology graph MergedGraph to an empty graph, with both the node set Nodes and the edge set Edges as empty sets;

[0036] Copy the first directed graph canGraph1 in the set CanGraphs to MergedGraph. The node set Nodes of MergedGraph is nodes1, and the edge set Edges is edges1. The duplication and weight of each node and each edge in the set are initialized to 1.

[0037] Scan each remaining directed graph CanGraph in the set CanGraphs in turn i , using the node merging algorithm combined with similarity to merge CanGraph i Merge the nodes in into MergedGraph and update the duplication and weight of the nodes;

[0038] Scan each remaining directed graph CanGraph in the set CanGraphs in turn i , the edge merging algorithm combined with similarity is used to merge CanGraph i Merge the edges in to MergedGraph and update the duplication and weight of the edges.

[0039] Optionally, update the duplication and weight of the nodes, including:

[0040] Scan the domain candidate ontology graph CanGraph in sequence i For each node tmpNode in the , get the node tag tmpNodeTag and node type tmpNodeType;

[0041] In the node set Nodes of MergedGraph, search for the node sameNode or the most similar node similarNode with the same node label as tmpNode. The most similar node similarNode is obtained using the vocabulary similarity calculation method. The node label is used as the vocabulary. The similarity value of the node similarNode is similarity>θ and the value is the largest. θ is the preset similarity threshold.

[0042] If the same node sameNode exists, determine whether the node types of tmpNode and sameNode are also the same; if they are the same, update the duplication and weight of sameNode in the MergedGraph, and increase both the duplication and weight by 1; if they are different, add the node tmpNode to the node set Nodes of the MergedGraph, and set both the duplication and weight of the node to 1;

[0043] If the same node sameNode does not exist but the most similar node similarNode exists, determine whether the types of tmpNode and similarNode are also the same; if they are the same, update the duplication and weight of similarNode in the MergedGraph, add 1 to the duplication and add the similarity value to the weight; update CanGraph i The node label of tmpNode is the node label of similarNode; if they are different, the node tmpNode is added to the node set Nodes of MergedGraph, and the duplication degree and weight of the node are both set to 1;

[0044] If neither sameNode nor similarNode exists, add the node tmpNode to the node set Nodes of MergedGraph, and set the node's duplication and weight to 1;

[0045] Repeat the iteration until the domain candidate ontology graph CanGraph i All nodes in the are processed.

[0046] Optionally, update the edge duplication and weight, including:

[0047] Scan the domain candidate ontology graph CanGraph in sequence i Get the subject and object node tags tmpHeadTag and tmpTailTag of the edge tmpEdge, as well as the edge type tmpEdgeType;

[0048] In the edge set Edges of MergedGraph, find the edges with the same subject and object node labels as tmpEdge and form the set sameHeadTails;

[0049] If there is no edge in the sameHeadTails set, add the edge tmpEdge to the edge set Edges of the MergedGraph, and set the edge duplication and weight to 1;

[0050] If there is an edge in the sameHeadTails set, then search for the edge sameEdge or the most similar edge similarEdge of the same type as tmpEdge in the set. The most similar edge similarEdge is obtained using the vocabulary similarity calculation method, with the edge type as the vocabulary; the similarity value of the edge similarEdge is similarity>λ and the value is the largest, where λ is the preset similarity threshold;

[0051] If the same edge sameEdge exists, update the duplication and weight of sameEdge in the MergedGraph, and increase both the duplication and weight by 1;

[0052] If the same edge sameEdge does not exist but the most similar edge similarEdge exists, then update the duplication and weight of similarEdge in the MergedGraph, add 1 to the duplication, and add the similarity value to the weight;

[0053] If neither sameNode nor similarNode exists, add edge tmpEdge to the edge set Edges of MergedGraph, and set the duplication degree and weight of the edge to 1;

[0054] Repeat the iteration until the domain candidate ontology graph CanGraph i All edges in are processed.

[0055] Optionally, the final domain ontology graph OntologyGraph is obtained, which specifically includes:

[0056] Initialize the domain ontology graph OntologyGraph to an empty graph;

[0057] For each node in the node set Nodes of the merged domain candidate ontology graph MergedGraph i Calculate its confidence nodeConfidence i =(repeatability i *weight i ) / K 2 , where repeatability i Nodes i Repeatability, weight i Nodes i The weight value of , K is the number of large models;

[0058] For each edge in the edge set Edges of the graph MergedGraph i Calculate its confidence edgeConfidence j =nodeConfidence head *nodeConfidence tail *(repeatability j *weight j ) / K 2 , where repeatability jEdges j Repeatability, weight j Edges j The weight value, K is the number of large models, nodeConfidence head Edges j The confidence of the corresponding subject node, nodeConfidence tail Edges j The confidence of the corresponding object node;

[0059] Sort all nodes in the node set Nodes by confidence from high to low, and scan each node in the node set Nodes in order from high to low confidence; if the confidence requirement is met, add the node, select the edges and adjacent points attached to the node that meet the confidence requirement, and add the nodes and edges that meet the confidence requirement to the final domain ontology graph OntologyGraph.

[0060] Optionally, add the nodes and edges that meet the confidence requirements to the final domain ontology graph OntologyGraph, including:

[0061] Scan each node tmpNode in the node set Nodes from high to low according to the confidence level, and determine whether its confidence level is greater than the set threshold α;

[0062] If not, the construction of the domain ontology graph OntologyGraph ends;

[0063] If true, first add the node tmpNode to the domain ontology graph OntologyGraph; then scan each edge tmpEdge attached to the node tmpNode in turn to determine whether its confidence is greater than the set threshold β; if true, add the edge tmpEdge and the other node to which the edge is attached to the domain ontology graph OntologyGraph;

[0064] Repeat the iteration until all edges attached to the node tmpNode are scanned;

[0065] Continue to scan the next node in the node set Nodes until all nodes that meet the confidence requirements are scanned. All added nodes and edges together form the final domain ontology graph OntologyGraph.

[0066] Compared with the prior art, the domain ontology construction method provided by the embodiment of the present invention has the following beneficial effects:

[0067] The present invention constructs domain ontology based on the knowledge of general large models, and forms a think tank by introducing multiple large models; it adopts a directed graph merging algorithm to realize the integration of multi-expert knowledge, so as to achieve the goal of the think tank to learn from each other's strengths and overcome its weaknesses. It can effectively utilize the knowledge breadth and natural language understanding ability of public large models, fully integrate the knowledge capabilities of multiple different public large models, and do not require the introduction of domain expert knowledge.

[0068] In addition, the confidence of the candidate domain ontology graph MergedGraph is evaluated, and the nodes and edges in the graph with confidence greater than the set threshold are selected. The consistency and accuracy of the domain ontology knowledge are analyzed to avoid knowledge and axiomatic errors in the domain ontology. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 The figure is a flowchart of a method for constructing a domain ontology provided in one embodiment. DETAILED DESCRIPTION

[0070] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present 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 only used to explain the present invention and are not intended to limit the present invention.

[0071] First, domain knowledge is derived from the results generated by a general-purpose large model, ensuring the accuracy and authority of the data. Second, the concepts and relationships involved in the domain ontology have a high level of lexical abstraction, and the large model's breadth of knowledge can effectively cover the various ontologies involved in domain ontology construction, including top-level, common sense, and task-based ontologies. Finally, the reasoning and thinking capabilities of the large model can effectively decompose and execute the complex task of domain ontology construction.

[0072] In one embodiment, a method for constructing a domain ontology is provided, the method comprising:

[0073] 1. Design domain ontology construction prompt word Prompt.

[0074] 2. Use the prompt word as the query text and execute the query in the user interface provided by several public large models to obtain the corresponding feedback text of the large models; the large model set is represented as: LLMs = {m1,m2,...m i ,...,m K}, m i is the i-th (1≤i≤K) large model, K is the number of large models selected, and the domain ontology feedback text set is expressed as: Responses={res1,res2,...res i ,...,res K},res i For model mi Text output.

[0075] 3. Feedback each text res in the large model text set Responses i Perform text parsing to obtain domain concepts, relationships, and attribute words in the text. Use domain concepts and attribute words as nodes, and the relationships between domain concepts and the relationships between domain concepts and attribute words as edges to construct the domain candidate ontology graph canGraph i , thus forming the domain candidate ontology graph set CanGraphs.

[0076] 4. Update the duplication and weight of each node and each edge in the domain candidate ontology graph set CanGraphs, and use the directed graph merging algorithm combined with similarity to merge the updated nodes and edges into the initialized weighted empty graph to obtain the domain candidate ontology graph MergedGraph.

[0077] 5. Perform confidence evaluation on the merged domain candidate ontology graph MergedGraph, select nodes and edges in the graph whose confidence is greater than the set threshold, and construct the final domain ontology graph OntologyGraph.

[0078] Example 1

[0079] The present invention provides a method for constructing domain ontology based on large models. By introducing multiple large models as "domain experts", the natural language understanding and knowledge capabilities of the large models are used to assist in the acquisition of domain ontology knowledge. The embodiment takes scenic tourism as the target field, uses domestic mainstream large models such as Zhipu Qingyan, Wenxin Yiyan, Byte Doubao and Keda Xinghuo as "domain experts", and designs prompt words with thought chains to obtain text feedback from large models. Based on these text feedbacks, several candidate domain ontology graphs are constructed, and algorithms such as semantic similarity calculation, graph merging and confidence assessment are used to integrate and evaluate the domain ontology knowledge of the large models to generate the final domain ontology, such as Figure 1 As shown, the following steps are included:

[0080] S1. Design the domain ontology to construct the prompt word Prompt. The specific steps are as follows:

[0081] S11. Decompose the domain ontology construction task into three information extraction subtasks: concept (entity type) classification, relationship (entity relationship) classification, and attribute (entity attribute relationship) classification;

[0082] S12. Design output templates for three information extraction subtasks. The corresponding indicators are as follows:

[0083] Concept classification subtask output template:

[0084] List the scenic area tourism vocabulary by category in the following format:

[0085] <Concept Category 1> includes <Concept Category 2> <Concept Category 3>, etc.

[0086] <Concept Category 2> includes <Concept Vocabulary 1> <Concept Vocabulary 2>, etc.

[0087] Relation classification subtask output template:

[0088] List the scenic area tourism ontology relationships by category in the following format:

[0089] <Relationship Category 1>: (<Concept Category 1>, <Concept Category 2>) etc.

[0090] <Relationship Category 2>: (<Conceptual Vocabulary 1>, <Conceptual Vocabulary 2>) etc.

[0091] Attribute classification subtask output template:

[0092] Please list the attributes of each concept of scenic tourism in the following format:

[0093] The attributes of <Concept Category 1> include <Concept Attribute 1> <Concept Attribute 2>, etc.

[0094] The attributes of <Concept Vocabulary 1> include <Concept Attribute 3> <Concept Attribute 4>, etc.

[0095] S13, select several public general large models, test the large model output and fine-tune the prompt words, select K available large model sets LLMs={m1,m2,...m i ,...,m K}, combined with the subtask output template, determine the prompt word Prompt for domain ontology construction, such as:

[0096] Please give the scenic spot tourism ontology structure according to the following requirements, and add general ontologies such as time, place, and people. No examples are needed.

[0097] The first step is to list the scenic spot tourism vocabulary by category in the following format:

[0098] <Concept Category 1> includes <Concept Category 2> <Concept Category 3>, etc.

[0099] <Concept Category 2> includes <Concept Vocabulary 1> <Concept Vocabulary 2>, etc.

[0100] The second step is to list the scenic area tourism ontology relationships by category. The format is as follows:

[0101] <Relationship Category 1>: (<Concept Category 1>, <Concept Category 2>) etc.

[0102] <Relationship Category 2>: (<Conceptual Vocabulary 1>, <Conceptual Vocabulary 2>) etc.

[0103] <Relationship Category 3>: (<Concept Category 3>, <Concept Vocabulary 3>) etc.

[0104] <Relationship Category 3>: (<Concept Vocabulary 4>, <Concept Category 4>) etc.

[0105] In the third step, please list the attributes of each concept category in the following format:

[0106] The attributes of <Concept Category 1> include <Concept Attribute 1> <Concept Attribute 2>, etc.

[0107] The attributes of <concept vocabulary 1> include <concept attribute 3>, <concept attribute 4>, etc.

[0108] S2. Use the prompt word as the query text and execute the query in the user interface provided by several public large models to obtain the corresponding feedback text of the large model; the large model set is represented as: LLMs = {m1,m2,...m i ,...,m K}, m i is the i-th (1≤i≤K) large model, K is the number of large models selected, and the domain ontology feedback text set is expressed as: Responses={res1,res2,...res i ,...,res K},res i For model m i Text output; for example, after querying ByteBean, some of the feedback text is:

[0109] <Scenic Area> includes <Natural Landscape Scenic Area> <Humanistic Landscape Scenic Area> <Comprehensive Scenic Area>, etc.

[0110] <Attractions> include <natural attractions> <human attractions> <entertainment attractions>, etc.

[0111] S3, each text res in the large model feedback text set Responses i Perform text parsing and construct the corresponding domain candidate ontology graph canGraph i (The nodes and edges in the graph correspond to concepts and relationships respectively), thus forming the domain candidate ontology graph set CanGraphs. The specific steps include:

[0112] S31, each text res in Responses in turn i Perform text parsing to get text res i The concept set contained in concepts i , attribute collection attributesi and relations i , the specific steps include:

[0113] S311, Initialize concept set concepts i , attribute collection attributes i and relations i is an empty set;

[0114] S312, scan the text res in sequence i Each row in resSentence i,j , judge resSentence according to the output template ij The type includes concept classification, relationship classification or attribute classification;

[0115] S313, if resSentence i,j Belong to the concept classification output template, then initialize the concept vocabulary set tmpConcepts to an empty set, and extract resentence according to the output template i,j Concept words in the text and added to the collection tmpConcepts;

[0116] S314, sequentially scan each concept word tmpConcepts in the concept word set tmpConcepts t , in the concept set concepts i Find each word in tmpConcepts t If it does not exist, the word tmpConcepts t Add to concepts collection concepts i ;

[0117] S315, take the first concept word tmpConcepts1 in the concept word set tmpConcepts as the main body, and all the remaining concept words tmpConcepts t is the object, the predicate or relation type is include, and they constitute relation triples (i.e. <tmpConcepts1,include,tmpConcepts i >) and add it to the relations collection i; For example: in the text "<scenic area> includes <natural landscape scenic area><human landscape scenic area><comprehensive scenic area>, etc.", "scenic area", "natural landscape scenic area" and "human landscape scenic area" are all conceptual words, among which the concept "scenic area" is the subject and "natural landscape scenic area" is the object, and the two constitute the relationship triple "scenic area, include, natural landscape scenic area".

[0118] S316, if resSentence i,j If it belongs to the relation classification output template, the relation set tmpRelations is initialized to an empty set, and resSentence is extracted according to the output template. ij The relationship name relName and several relationship pairs in the text are added to the collection tmpRelations;

[0119] S317, scan the relationship set tmpRelations in sequence, and use each relationship in the set to tmpRelations t The two concept words tmpConcept1 and tmpConcept2 are subject and object respectively, and the predicate or relation type is relName, forming a relation triple (i.e.<tmpConcept1,relName,tmpConcept2> ) and add it to the relations collection i For example, in the text "<Subordinate Relationship>: (<Tourism Organization Management Category>, <Travel Agency>), (<Travel Agency>, <Tour Guide>), (<Scenic Area Management Department>, <Operation Management Department>)", "Travel Agency" and "Tour Guide" have a "Subordinate" relationship, so they can form the triple <Travel Agency, Subordinate, Tour Guide>";

[0120] S318, if resSentence i,j Belongs to the attribute classification output template, then initialize the attribute set tmpAttributes to an empty set, and extract resentence according to the output template ij The concept word conName and all attribute words in the text are added to the collection tmpAttributes;

[0121] S319, scan each attribute vocabulary tmpAttributes in the attribute vocabulary set tmpAttributes in turn t , the vocabulary tmpAttributes t Add to the attribute node collection attributes i ;

[0122] S3110, sequentially scan each attribute vocabulary tmpAttributes in the attribute vocabulary set tmpAttributes t , with the concept vocabulary conName as the main body and the attribute vocabulary tmpAttributes t is the object, the predicate or relation type is hasAttribute, and they constitute the relation triples (i.e. <conName,hasAttribute,tmpNode i >) and add it to the relations collection i For example: "The attributes of <scenic area> include <scenic area area><number of attractions><landscape features><ticket price><opening policy>, etc.", "scenic area area" and "number of attractions" are all attributes of the concept "scenic area", so they can form triples such as "scenic area, hasAttribute, scenic area area".

[0123] S3111, repeat the above steps until the text res i Until all text lines in the are processed.

[0124] S32, by concept set concepts i , attribute collection attributes i and relations i Build text res i Corresponding domain candidate ontology graph canGraph i , the specific steps include:

[0125] S321. Initialize the domain candidate ontology graph canGraph i It is an empty graph, that is, its node set nodes i and edge sets edges i are all empty sets;

[0126] S322, Scan concept set concepts i Each concept in concepts i,j , in the domain candidate ontology graph canGraph i The node set nodes i Add a node with the label concepts i,j , type is conType;

[0127] S323, Scan attribute set attributes i Each attribute in attributes i,j , in the domain candidate ontology graph canGraph i The node set nodesi Add a node with the label attributes i,j , type is attType;

[0128] S324, scan relationship set relations i Each relationship in i,j , let the corresponding relation triple be<head,relType,tail> , respectively in the graph canGraph i Find the concept nodes or attribute nodes headNode and tailNode corresponding to head and tail in the domain candidate ontology graph canGraph i The edge set edges i Add a directed edge from headNode to tailNode with the edge type of relType.

[0129] S33. Add the domain candidate ontology graph to the domain candidate ontology graph set CanGraphs.

[0130] S4. Use the directed graph merging algorithm combined with similarity to merge the domain candidate ontology graph set CanGraphs and construct the merged domain candidate ontology graph MergedGraph. The specific steps include:

[0131] S41, initialize the weighted domain candidate ontology graph MergedGraph to an empty graph, that is, its node set Nodes and edge set Edges are both empty sets;

[0132] S42. Copy the first directed graph canGraph1 in the set CanGraphs to MergedGraph, that is, the node set Nodes of MergedGraph = nodes1, the edge set Edges = edges1, and the duplication and weight of each node and each edge in the set are initialized to 1;

[0133] S43, scan each remaining directed graph CanGraph in the set CanGraphs in turn i , using the node merging algorithm combined with similarity to merge CanGraph i Merge the nodes in the MergedGraph and update the duplication and weight of the nodes. The specific steps include:

[0134] S431, scan the domain candidate ontology graph CanGraph in sequence i For each node tmpNode in the , get the node tag tmpNodeTag and node type tmpNodeType;

[0135] S432. Search the node sameNode or the most similar node similarNode in the node set Nodes of the MergedGraph for the node with the same node label as tmpNode. The most similar node similarNode is obtained using a vocabulary similarity calculation method (with the node label as the vocabulary). The similarity value of the node similarNode is similarity>θ and is the largest (θ is a preset similarity threshold).

[0136] S433. If the same node sameNode exists, determine whether the node type of tmpNode and sameNode are also the same. If they are, update the duplication and weight of sameNode in the MergedGraph (i.e., increase both duplication and weight by 1). If they are different, add the node tmpNode to the node set Nodes of the MergedGraph, and set both the duplication and weight of the node to 1.

[0137] S434. If the same node sameNode does not exist but the most similar node similarNode exists, determine whether the types of tmpNode and similarNode are also the same. If they are the same, update the duplication (i.e. duplication plus 1) and weight (i.e. weight plus similarity) of similarNode in MergedGraph, and update CanGraph i The node label of tmpNode is the node label of similarNode; if they are different, the node tmpNode is added to the node set Nodes of MergedGraph, and the duplication degree and weight of the node are both set to 1;

[0138] S435. If neither sameNode nor similarNode exists, add the node tmpNode to the node set Nodes of the MergedGraph, and set the node's duplication degree and weight to 1.

[0139] S436, repeat the above process until the domain candidate ontology graph CanGraph i All nodes in the are processed.

[0140] S44, scan each remaining directed graph CanGraph in the set CanGraphs in turn i , the edge merging algorithm combined with similarity is used to merge CanGraph i Merge the edges in to MergedGraph and update the duplication and weight of the edges. The specific steps include:

[0141] S441, scan the domain candidate ontology graph CanGraph in sequence i Get the subject and object node tags tmpHeadTag and tmpTailTag of the edge tmpEdge, as well as the edge type tmpEdgeType;

[0142] S442. Search the edge set Edges of the MergedGraph for edges with the same subject and object node labels as tmpEdge, and form a set sameHeadTails (multiple relationships between subjects and objects are allowed).

[0143] S443. If there is no edge in the sameHeadTails set, add the edge tmpEdge to the edge set Edges of the MergedGraph, and set the duplication degree and weight of the edge to 1.

[0144] S444. If there is an edge in the sameHeadTails set, search the set for an edge sameEdge or a most similar edge similarEdge that has the same edge type as tmpEdge. The most similar edge similarEdge is obtained using a vocabulary similarity calculation method (with edge type as the vocabulary), and the similarity value of the edge similarEdge is greater than λ and is the largest (λ is a preset similarity threshold).

[0145] S445. If the same edge sameEdge exists, update the duplication degree and weight of sameEdge in the MergedGraph (i.e., both the duplication degree and the weight are increased by 1);

[0146] S446. If the same edge sameEdge does not exist but the most similar edge similarEdge exists, then update the duplication (i.e., duplication plus 1) and weight (i.e., weight plus similarity value similarity) of similarEdge in the MergedGraph.

[0147] S447. If neither sameNode nor similarNode exists, add edge tmpEdge to the edge set Edges of MergedGraph, and set the duplication degree and weight of the edge to 1.

[0148] S448, repeat the above process until the domain candidate ontology graph CanGraph i All edges in are processed.

[0149] S5. Confidence evaluation is performed on the merged candidate ontology graph MergedGraph, and nodes and edges with confidence greater than a set threshold are selected to construct the final domain ontology graph OntologyGraph. The specific steps include:

[0150] S51, initialize the domain ontology graph OntologyGraph to an empty graph;

[0151] S52, for each node in the node set Nodes of the merged domain candidate ontology graph MergedGraph i Calculate its confidence nodeConfidence i =(repeatability i *weight i ) / K 2 , where repeatability i Nodes i Repeatability, weight i Nodes i The weight value of , K is the number of large models;

[0152] S53, for each edge in the edge set Edges of the graph MergedGraph i Calculate its confidence edgeConfidence j =nodeConfidence head *nodeConfidence tail *(repeatability j *weight j ) / K 2 , where repeatability j Edges j Repeatability, weight j Edges j The weight value, K is the number of large models, nodeConfidence head Edges j The confidence of the corresponding subject node, nodeConfidence tail Edges j The confidence of the corresponding object node;

[0153] S54, sorting all nodes in the node set Nodes from high to low according to confidence;

[0154] S55. Scan each node in the node set Nodes in descending order of confidence. If the confidence requirement is met, add the node. Select the edges and adjacent nodes attached to the node that meet the confidence requirement. Add these nodes and edges to the final domain ontology graph OntologyGraph. The specific steps include:

[0155] S551, scan each node tmpNode in the node set Nodes from high to low according to the confidence level, and determine whether its confidence level is greater than the set threshold α;

[0156] S552: If not, the construction of the domain ontology graph OntologyGraph is completed;

[0157] S553. If so, first add the node tmpNode to the domain ontology graph OntologyGraph;

[0158] S554, then scan each edge tmpEdge attached to the node tmpNode in turn to determine whether its confidence is greater than the set threshold β;

[0159] S555. If so, add the edge tmpEdge and the other node to which the edge is attached to the domain ontology graph OntologyGraph;

[0160] S556. Repeat the above two steps until all edges attached to the node tmpNode are scanned.

[0161] S557, continue scanning the next node in the node set Nodes until all nodes that meet the confidence requirements are scanned;

[0162] S558. All nodes and edges added in the above process together form the final domain ontology graph OntologyGraph.

[0163] The present invention provides a method for constructing a domain ontology based on a large model. First, the domain ontology is constructed based on the knowledge of a general large model. The knowledge breadth and migration capability of the large model provide a strong guarantee for the accuracy and recall rate of the domain ontology knowledge. Second, the model prompt words are designed in the form of a thinking chain, and the natural language understanding and reasoning capabilities of the large model are used to effectively decompose and execute the domain ontology construction task. Third, by introducing multiple large model "domain experts" to form a "think tank", a directed graph merging algorithm is used to realize the integration of multi-expert knowledge, so as to achieve the goal of "learning from each other's strengths and overcoming each other's weaknesses" of the think tank. Finally, semantic similarity calculation and confidence assessment are used to analyze the consistency and accuracy of the domain ontology knowledge, so as to avoid the knowledge and axiomatic errors that may occur in the domain ontology.

[0164] The above-described embodiments merely illustrate several implementations of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, and all such variations and improvements fall within the scope of protection of the present invention.

Claims

1. A method for constructing a domain ontology, characterized in that: include: Get the prompt words for domain ontology construction ; The prompt words for obtaining domain ontology construction , specifically including: The domain ontology construction task is decomposed into three information extraction subtasks including concept classification, relationship classification and attribute classification; Design output templates for the three information extraction subtasks respectively; Select multiple public large models, test the output of each public large model and fine-tune the prompt words, select A large collection of models available with domain knowledge ; Determine the prompt words based on the output template of the information extraction subtask and the large model set ; The prompt word Use the query text to query in the user interface provided by multiple public large models, and obtain the domain ontology feedback text set composed of the feedback text output by each large model. ; wherein the multiple public large models are represented as: , The total number of public models, For the The domain ontology feedback text collection is specifically , For the A feedback text of the public large model output; Feedback text collection for domain ontology Each feedback text in the text is parsed to obtain the domain concepts, relationships and attribute words in the text; domain concepts and attribute words are used as nodes, and the relationships between domain concepts and the relationships between domain concepts and attribute words are used as edges to construct a domain candidate ontology graph. , get the domain candidate ontology graph set ; Domain candidate ontology graph set The duplication and weight of each node and each edge in the domain are updated, and the updated nodes and edges are merged into the initialized weighted empty graph using the directed graph merging algorithm combined with similarity to obtain the domain candidate ontology graph. ; Domain candidate ontology graph Perform confidence assessment, select nodes and edges in the graph whose confidence is greater than the set threshold, and obtain the final domain ontology graph .

2. A method for constructing a domain ontology according to claim 1, characterized in that: Constructing a candidate domain ontology graph , specifically including: In turn Each text in Perform text parsing to obtain text The concept set contained in , attribute collection and relationship sets ; Based on concept collection , attribute collection and relationship sets , construct text Corresponding domain candidate ontology graph ; Add the domain candidate ontology graph to the domain candidate ontology graph collection .

3. A method for constructing a domain ontology according to claim 2, characterized in that: The sequential Each text in Perform text parsing, including: Initialize concept set , attribute collection and relationship sets is an empty set; Scan text sequentially Each row , according to the output template The type includes concept classification, relationship classification or attribute classification; like Belongs to the concept classification output template, then initialize the concept vocabulary set Empty set, extracted according to output template Concept words in the text and add them to the collection ; Scan the concept vocabulary set in sequence Each concept word in , in the concept set Look up each word If it does not exist, the word Add to concept collection ; Concept vocabulary collection The first concept word in As the main body, all the remaining concept words is the object, the predicate or relation type is , respectively forming relation triples and adding them to the relation set ; like Belongs to the relation classification output template, then initialize the relation set Empty set, extracted according to output template Relation names in text and several relationship pairs and add them to the collection ; Scan the relationship set in sequence , for each relation pair in the set Two conceptual terms and are the subject and object respectively, and the predicate or relation type is , forming a relation triple and adding it to the relation set ; like Belongs to the attribute classification output template, then initialize the attribute set Empty set, extracted according to output template Conceptual vocabulary in the text and all attribute words and add to the collection ; Scan the attribute vocabulary set in sequence Each attribute word in , the vocabulary Add to attribute node collection ; Scan the attribute vocabulary set sequentially Each attribute word in , with conceptual vocabulary For the subject, attribute vocabulary is the object, the predicate or relation type is , respectively forming relation triples and adding them to the relation set ; Repeat until the text Until all text lines in the are processed.

4. A method for constructing a domain ontology according to claim 2, characterized in that: The constructed text Corresponding domain candidate ontology graph , specifically including: Initialize the domain candidate ontology graph Empty graph, node set and edge sets are all empty sets; Scanning concept set Each concept , in the domain candidate ontology graph The node set Add a node with the label , of type ; Scan attribute collection Each attribute , in the domain candidate ontology graph The node set Add a node with the label , of type ; Scanning a Relationship Set Each relationship in , let the corresponding relation triple be , respectively in Figure Found and Corresponding concept node or attribute node and , in the domain candidate ontology graph The edge set Add a line from arrive The directed edge of .

5. A method for constructing a domain ontology according to claim 2, characterized in that: The domain candidate ontology graph obtained , specifically including: Initialize the domain candidate ontology graph with weights Empty graph, node set and edge sets are all empty sets; will be collected The first directed graph in Copy to , The node set , edge set , the duplication and weight of each node and each edge in the set are initialized to 1; Scan the collection sequentially Each of the remaining directed graphs in , the node merging algorithm combined with similarity is used to The nodes in are merged into , and update the duplication and weight of the nodes; Scan the collection sequentially Each of the remaining directed graphs in , the edge merging algorithm combined with similarity is used to Merge the edges in , and update the edge duplication and weight.

6. A method for constructing a domain ontology according to claim 5, characterized in that: The update node repetition and weight specifically include: Scan the domain candidate ontology graph sequentially Each node in , get the node label and node type ; exist The node set Find and Nodes with the same node label or most similar nodes , where the most similar node The similarity calculation method of vocabulary is used to obtain the node label. Similarity value And the value is the largest, is the preset similarity threshold; If the same node Existence, judgment and Are the node types of the same? If they are the same, update In the picture The repetition and weight of the repetition and weight are increased by 1; if they are different, The node set Add a node , the duplication and weight of the nodes are set to 1; If the same node Does not exist but the most similar node exists ,judge and Is the type the same? If so, update In the picture The repetition and weight of the repetition plus 1, the weight plus the similarity value ;renew middle The node label is Node labels; if different, then The node set Add a node , the duplication and weight of the nodes are set to 1; like and If neither exists, then The node set Add a node , the duplication and weight of the nodes are set to 1; Repeat the iteration until the domain candidate ontology graph All nodes in the are processed.

7. A method for constructing a domain ontology according to claim 5, characterized in that: The update edge repetition and weight specifically include: Scan the domain candidate ontology graph sequentially Edge , get the subject and object node labels to which the edge is attached and , and the type of edge ; exist The edge set Find and The subject and object node labels of the edges are the same, and form a set ; like There is no edge in the set, then The edge set Add edges , the duplication and weight of the edge are both set to 1; like If there is an edge in the set, then search for the edge in the set that matches Edges of the same type or most similar edge , where the most similar edge The similarity calculation method of words is used to obtain the edge type, which is the word; the edge Similarity value And the value is the largest, is the preset similarity threshold; If the same side If exists, update In the picture The repetition and weight of , both the repetition and weight are increased by 1; If the same side Does not exist but the most similar edge exists , then update In the picture The repetition and weight of the repetition plus 1, the weight plus the similarity value ; like and If neither exists, then The edge set Add edges , the duplication and weight of the edge are both set to 1; Repeat the iteration until the domain candidate ontology graph All edges in are processed.

8. A method for constructing a domain ontology according to claim 1, characterized in that: The final domain ontology graph is obtained , specifically including: Initialize the domain ontology graph It is an empty graph; The merged domain candidate ontology graph The node set Each node in Calculate its confidence ,in For nodes The repetition rate, For nodes The weight value of is the number of large models; Paired images The edge set Each edge in Calculate its confidence ,in For the edge The repetition rate, For the edge The weight value of is the number of large models, For the edge The confidence of the corresponding subject node, For the edge The confidence of the corresponding object node; Node Set All nodes in the list are sorted from high to low by confidence, and the node set is scanned in order from high to low by confidence. Each node in the domain ontology; if it meets the confidence requirements, add the node, select the edges and adjacent points attached to the node that meet the confidence requirements, and add the nodes and edges that meet the confidence requirements to the final domain ontology graph .

9. A method for constructing a domain ontology according to claim 8, characterized in that: The nodes and edges that meet the confidence requirements are added to the final domain ontology graph , specifically including: Scan the node set from high to low confidence Each node in , to determine whether its confidence is greater than the set threshold ; If not, then the domain ontology diagram The construction is completed; If established, first in the domain ontology diagram Add a node ; Then scan the nodes attached to it in turn Each edge of , to determine whether its confidence is greater than the set threshold ; If true, then in the domain ontology diagram Add edges and the other node to which the edge is attached; Repeat the iteration until it is attached to the node All edge scans are completed; Continue scanning the node set The next node is added until all nodes that meet the confidence requirements are scanned. All the added nodes and edges together form the final domain ontology graph. .

Citation Information

Patent Citations

  • Auxiliary diagnosis method, device and equipment and storage medium

    CN116705299A

  • News data knowledge graph construction method based on artificial intelligence

    CN118396092A