Domain-extensible knowledge graph construction method, device and equipment and medium
By constructing an ontology structure for a domain knowledge graph and employing a self-training knowledge enhancement method, the problems of scalability and knowledge extraction performance of domain knowledge graphs in different domains are solved. This enables rapid integration of algorithm models and fusion of domain characteristics, thereby improving construction efficiency and extraction performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU WEIMING XINKE TECH CO LTD
- Filing Date
- 2023-06-14
- Publication Date
- 2026-07-03
AI Technical Summary
Existing domain knowledge graph construction methods have low scalability across different domains, making it difficult to quickly integrate different algorithms and models. Furthermore, they do not fully incorporate domain characteristics, resulting in limited knowledge extraction performance. Relying on external knowledge bases makes it difficult to achieve efficient extraction in vertical domains.
By constructing an ontology structure for a domain knowledge graph, collecting domain data, and deploying multiple pre-set algorithms as APIs for microservices, entity and relation extraction is performed using self-trained knowledge enhancement to form triples, thereby enabling rapid integration of algorithm models and fusion of domain knowledge.
It improves the scalability of domain knowledge graphs, reduces manpower and time costs, enhances knowledge extraction performance, and reduces dependence on external knowledge bases.
Smart Images

Figure CN116702895B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph technology, and in particular to a method, apparatus, device, and medium for constructing a domain-scalable knowledge graph. Background Technology
[0002] Knowledge graphs provide a crucial technological means for extracting knowledge from massive amounts of multi-source unstructured data and utilizing graph analysis for knowledge mining. With the advent of the industrial internet era, the demand for knowledge graph construction has evolved from large-scale, simple business scenarios such as internet search, recommendation, and question answering to small-scale, complex applications in specific domains. However, relying solely on experts to manually construct domain knowledge graphs is not only costly but also inefficient. Therefore, automated methods and systems for constructing domain knowledge graphs that reduce manpower and improve efficiency are currently a hot research topic.
[0003] However, existing technical solutions generally suffer from low domain scalability and limited domain knowledge extraction capabilities. Due to differences in domain characteristics, different domains require different knowledge extraction algorithms and models for knowledge graph construction, which to some extent affects the scalability of automatic domain knowledge graph construction methods and systems. Existing automatic domain knowledge graph construction solutions are only geared towards their respective domains and are difficult to quickly extend to other domains. Furthermore, due to the specialized nature of domains, knowledge extraction within a domain faces characteristics such as low frequency, long tails, and logical complexity; moreover, compared to general domains, domain data is more difficult to acquire and label; this leads to limitations in the extraction capabilities of data-driven methods. Summary of the Invention
[0004] This application provides a method, apparatus, device, and medium for constructing a domain-scalable knowledge graph. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0005] In a first aspect, embodiments of this application provide a domain-scalable knowledge graph construction method, including:
[0006] Construct the ontology structure of the domain knowledge graph and collect domain data;
[0007] Deploy multiple pre-defined algorithms required for knowledge extraction into an algorithm repository, and generate API calls for each algorithm in a microservice manner;
[0008] By calling the API of the target algorithm, entities and relations are extracted from the collected domain data to form triples. The triples are then imported into the ontology structure of the domain knowledge graph to obtain the completed domain knowledge graph.
[0009] In an optional embodiment, constructing the ontology structure of the domain knowledge graph includes:
[0010] By defining entity types, entity attribute fields, and relationship types between entities in the domain knowledge graph, the ontology structure of the constructed domain knowledge graph is obtained.
[0011] In an optional embodiment, multiple pre-defined algorithms required for knowledge extraction are deployed to an algorithm repository, and API calls for each algorithm are generated in a microservice manner, including:
[0012] Upload the source code, algorithm model, and algorithm dependency files of the multiple preset algorithms required for knowledge extraction;
[0013] Based on the source code, algorithm model, and algorithm dependency files of multiple preset algorithms, the algorithm is deployed to the algorithm repository in the form of microservices, and an API for calling each algorithm is generated.
[0014] In an optional embodiment, by calling the API of the target algorithm, entity and relation extraction is performed on the collected domain data to form triples, including:
[0015] By calling the named entity recognition algorithm, a vector representation is generated for each entity in the domain data text to achieve entity embedding. By calling the relation extraction algorithm, a vector representation is generated for entity pairs to achieve relation embedding.
[0016] By calling the knowledge representation learning algorithm to generate knowledge vectors of entities and relations in the domain knowledge graph, the embedded entity vectors, entity pair vectors and knowledge vectors are jointly learned to obtain entity fusion vectors and entity pair fusion vectors.
[0017] The entity fusion vector is labeled by calling the classifier of the named entity recognition algorithm to determine the entity boundaries. The entity pair fusion vector is then labeled by calling the classifier of the relation extraction algorithm to extract the entity relations and form triples.
[0018] In an optional embodiment, generating knowledge vectors for entities and relations in a domain knowledge graph by invoking a knowledge representation learning algorithm includes:
[0019] Randomly initialize the knowledge vectors of entities and relations in the domain knowledge graph;
[0020] For a triple, randomly select other entities and relations in the graph to replace the head entity, relation, and tail entity in the triple, respectively, to construct 3 negative samples;
[0021] Based on the scoring function of the translation model, a loss function is constructed;
[0022] The loss function is used to calculate the loss of positive sample triples and their corresponding negative sample triples. The gradient descent method is used to update the knowledge vectors of entities and relations until the number of iterations reaches the preset maximum number of iterations.
[0023] In an optional embodiment, invoking the API of the target algorithm includes:
[0024] Data is received and sent using the HTTP POST method, following the input format specified by the target algorithm.
[0025] When it is necessary to replace the target algorithm, the algorithm can be replaced by changing the API used.
[0026] In an optional embodiment, collecting domain data includes:
[0027] Collect cross-domain or target domain data through data crawling technology;
[0028] The collected data is cleaned, and the text data is extracted.
[0029] Secondly, embodiments of this application provide a domain-scalable knowledge graph construction apparatus, including:
[0030] The data acquisition module is used to construct the ontology structure of the domain knowledge graph and collect domain data.
[0031] The algorithm deployment module is used to deploy multiple preset algorithms required for knowledge extraction to the algorithm repository and generate API calls for each algorithm in a microservice manner.
[0032] The construction module is used to extract entities and relations from the collected domain data by calling the API of the target algorithm, forming triples, and then importing the formed triples into the ontology structure of the domain knowledge graph to obtain the completed domain knowledge graph.
[0033] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing program instructions, wherein the processor is configured to execute the domain-scalable knowledge graph construction method provided in the above embodiments when executing the program instructions.
[0034] Fourthly, embodiments of this application provide a computer-readable medium storing computer-readable instructions, which are executed by a processor to implement a domain-scalable knowledge graph construction method provided in the above embodiments.
[0035] The technical solutions provided in this application embodiment may include the following beneficial effects:
[0036] The domain knowledge graph construction method provided in this application has good domain scalability. By generating APIs for calling various algorithms in the form of microservices, it can realize the rapid integration of algorithms and models in different domains, reduce the manpower and time costs of accessing algorithm models when applying in different domains, and improve the efficiency of graph construction.
[0037] Furthermore, the method in this application integrates domain knowledge into the knowledge graph construction process, enabling the knowledge extraction algorithm model to better integrate with domain characteristics and improve the performance of domain knowledge extraction. Using self-trained knowledge enhancement for domain knowledge fusion avoids introducing external knowledge bases, thus reducing dependence on domain data.
[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0040] Figure 1 This is a schematic diagram of a domain-scalable knowledge graph construction method provided according to an exemplary embodiment;
[0041] Figure 2 This is a schematic diagram illustrating a domain-scalable knowledge graph construction method according to an exemplary embodiment;
[0042] Figure 3 This is a schematic diagram illustrating a domain-scalable knowledge graph construction system according to an exemplary embodiment;
[0043] Figure 4 This is a schematic diagram of a domain-scalable knowledge graph construction device according to an exemplary embodiment;
[0044] Figure 5 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment;
[0045] Figure 6 This is a schematic diagram illustrating a computer storage medium according to an exemplary embodiment. Detailed Implementation
[0046] The following description and accompanying drawings fully illustrate specific embodiments of the invention to enable those skilled in the art to practice them.
[0047] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0048] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of systems and methods consistent with some aspects of the invention as detailed in the appended claims.
[0049] Existing technical solutions generally suffer from two problems: low domain scalability and limited domain knowledge extraction capabilities. Due to differences in domain characteristics, different domains require different knowledge extraction algorithms and models for knowledge graph construction, which to some extent affects the scalability of automatic domain knowledge graph construction methods and systems. Existing automatic domain knowledge graph construction solutions are only geared towards their own domain and are difficult to quickly extend to other domains. Alternatively, they rely on a unified hierarchical framework for extraction tasks to achieve multiple types of knowledge extraction. However, they do not consider how to integrate algorithms and models used in different domains into the construction process in a unified paradigm, so the domain scalability of this method is also low.
[0050] Due to the specialized nature of domains, knowledge extraction within a domain faces challenges such as low frequency, long tails, and logical complexity. Furthermore, compared to general domains, acquiring and labeling domain data is significantly more difficult, limiting the extraction capabilities of data-driven methods. Simply extracting domain characteristics from the data itself is insufficient to integrate deep-seated domain specialization, thus reducing the performance of domain knowledge extraction. Knowledge enhancement mechanisms can effectively model the intrinsic relationships between domain data and domain features, thereby improving extraction efficiency. However, existing knowledge enhancement-based extraction methods all rely on external knowledge, requiring the introduction of pre-built knowledge bases, which is lacking and difficult to implement in most vertical domains.
[0051] Based on this, this application proposes a domain knowledge graph construction method with domain scalability and self-training knowledge enhancement, which can solve the following three problems:
[0052] 1. Existing domain knowledge graph construction methods suffer from limited domain scalability. Knowledge extraction algorithms and models are likely to differ across domains, but current technologies lack a method for quickly integrating different algorithms and models. This necessitates significant manpower for interfacing the construction process with the algorithm models when applying knowledge graph construction methods across different domains.
[0053] 2. Existing domain knowledge graph construction methods do not fully integrate domain characteristics, resulting in limited knowledge extraction performance. Most existing technologies only obtain hidden domain characteristics through domain data annotation. The training of knowledge extraction models lacks guidance from explicit domain knowledge, making it difficult to integrate deep-level domain characteristics and impacting knowledge extraction performance.
[0054] 3. Existing knowledge-enhanced extraction methods rely on external knowledge. Due to the specialized complexity of vertical domains, it is difficult to obtain a large amount of high-quality external knowledge in most fields; this results in the limited application of existing technologies in vertical domain knowledge extraction.
[0055] The method for constructing a domain-scalable knowledge graph according to embodiments of this application will be described in detail below with reference to the accompanying drawings. See also Figure 1 The method specifically includes the following steps.
[0056] S101 constructs the ontology structure of the domain knowledge graph and collects domain data.
[0057] In one possible implementation, the ontology structure of the domain knowledge graph is first constructed, including defining the entity types, entity attribute fields, and relationship types between entities in the domain knowledge graph, thus obtaining the ontology structure of the constructed domain knowledge graph.
[0058] Furthermore, domain-specific data is collected. In one implementation, data crawling technology is used to collect data from cross-domain data sources or domain-specific data sources. Cross-domain data sources include patent websites and news websites; domain-specific data sources include collecting domain data from domain portal websites, such as collecting medical data from medical websites, to construct a medical domain knowledge graph. The acquired domain data is then cleaned to remove abnormal data and extract the text data.
[0059] S102 deploys multiple pre-defined algorithms needed for knowledge extraction to an algorithm repository and generates API calls for each algorithm in a microservice manner.
[0060] Due to differences in domain characteristics, different domains require different knowledge extraction algorithms and models for knowledge graph construction, which to some extent affects the scalability of automatic domain knowledge graph construction methods and systems. Therefore, the solution in this application is to deploy multiple preset algorithms needed for knowledge extraction to an algorithm repository and generate API calls for each algorithm in a microservice manner.
[0061] Specifically, obtain multiple preset algorithms that need to be used, such as named entity recognition algorithms and relation extraction algorithms, and then upload the source code, algorithm model, and algorithm dependency files of the multiple preset algorithms that need to be used in knowledge extraction; based on the source code, algorithm model, and algorithm dependency files of the multiple preset algorithms, deploy them to the algorithm repository in the form of microservices, and generate the calling API for each algorithm.
[0062] When invoking an algorithm, use the API specified for that algorithm and send and receive data via HTTP POST, following the input format defined by the algorithm. To replace an algorithm, simply change the API used.
[0063] This step enables the rapid integration of algorithms and models from different fields by calling the APIs of the algorithm models required for data from different fields. This reduces the manpower and time costs of accessing algorithm models when applying them in different fields and improves the efficiency of graph construction.
[0064] S103 extracts entities and relations from the collected domain data by calling the API of the target algorithm, forming triples, and imports the formed triples into the ontology structure of the domain knowledge graph to obtain the completed domain knowledge graph.
[0065] Specifically, by calling the named entity recognition algorithm, a vector representation is generated for each entity in the domain data text to achieve entity embedding; by calling the relation extraction algorithm, a vector representation is generated for entity pairs to achieve relation embedding.
[0066] In one possible implementation, an encoder of a named entity recognition model generates a vector representation for each token in the text, thus achieving entity embedding. For relation embedding, an encoder of a relation extraction model generates vector representations for entity pairs. The named entity recognition model and the relation extraction model are invoked via an algorithm API. Following this process, the embedding of entities and entity relations is generated.
[0067] Furthermore, by calling the knowledge representation learning algorithm to generate knowledge vectors of entities and relations in the domain knowledge graph, the embedded entity vectors, entity pair vectors and knowledge vectors are jointly learned to obtain entity fusion vectors and entity pair fusion vectors.
[0068] The domain knowledge representation learning module uses a knowledge representation learning algorithm to generate vectors of entities and relations in the current domain knowledge graph. When the update increment of the domain knowledge graph reaches a set threshold, this module runs the knowledge representation algorithm to generate the latest entity and relation vectors.
[0069] In one possible implementation, knowledge vectors for entities and relations in a domain knowledge graph are generated by invoking a knowledge representation learning algorithm, including:
[0070] First, randomly initialize the knowledge vectors of entities and relations in the domain knowledge graph;
[0071] For a triple Randomly select other entities and relations in the graph to replace the head entity, relation, and tail entity in c, respectively, to construct 3 negative samples: , , ;
[0072] Scoring function based on translation model: Construct the loss function: .
[0073] The loss function is used to calculate the loss of positive sample triples and their corresponding negative sample triples. Gradient descent is used to update the knowledge vectors of entities and relations until the number of iterations reaches the preset maximum number of iterations.
[0074] Furthermore, the embedded entity vectors, entity pair vectors, and knowledge vectors are jointly learned to obtain entity fusion vectors and entity pair fusion vectors.
[0075] This application integrates domain knowledge into the knowledge graph construction process, enabling the knowledge extraction algorithm model to better integrate with domain characteristics and improve the performance of domain knowledge extraction. Furthermore, it uses self-trained knowledge enhancement for domain knowledge fusion, without introducing external knowledge bases, thus reducing dependence on domain data.
[0076] Furthermore, the entity fusion vector is labeled and classified by calling the classifier of the named entity recognition algorithm to determine the entity boundaries. Then, the entity pair fusion vector is classified by calling the classifier of the relation extraction algorithm to extract the entity relations and form triples. The formed triples are imported into the ontology structure of the domain knowledge graph to obtain the constructed domain knowledge graph.
[0077] The following detailed description of the named entity recognition and relation extraction method of this application, with reference to specific embodiments, illustrates this method. For named entity recognition, given a sentence of length N (containing N tokens), an encoder is used... Generate a vector representation for the i-th token. ;
[0078] Given knowledge representation learning to generate domain knowledge graph entity embeddings ,
[0079] Calculate the attention score between the text token representation and the domain knowledge representation:
[0080] ;
[0081] ;
[0082] ;
[0083] Based on the attention score, the final encoding of the current token in the text is obtained:
[0084] ;
[0085] The above Random initialization is performed, and the final value is obtained by training the entity recognition model using its training data. This results in a token vector incorporating domain knowledge. Input to classifier In the process, the token tag is obtained, and the entity is extracted.
[0086] For relation extraction, given text and a pair of entities, an encoder is used. Generate deep semantic vector representations for sentence entities ;
[0087] Given knowledge representation learning to generate domain knowledge graph entity embeddings Attention score between computational domain knowledge representation and sentence entity representation:
[0088] ;
[0089] ;
[0090] ;
[0091] Based on the attention score, the final encoding of the sentence entity representation is obtained:
[0092] ;
[0093] The above Random initialization is performed, followed by training with the relation extraction model's training data to obtain the final value. The text entity vector u, incorporating domain knowledge, is then input into the classifier. In this process, we obtain a classification of relationships.
[0094] It is worth noting that the specific execution process described above can be implemented using other algorithms besides the one illustrated above, and this application does not limit it.
[0095] Figure 2 This is a schematic diagram illustrating a domain-scalable knowledge graph construction method according to an exemplary embodiment. To further explain the domain-scalable knowledge graph construction method provided in this application embodiment, the following is in conjunction with the attached diagram. Figure 2 Detailed explanation, such as Figure 2 As shown, the algorithm repository stores multiple algorithms, including entity recognition algorithms and relation extraction algorithms from different domains. The stored algorithm models are organized into microservices that call APIs. Then, domain data is collected from data sources, and the corresponding algorithm models are invoked according to the API calls to achieve knowledge-enhanced entity relation extraction. This includes entity / relation embedding generation, fusion of entity / relation embedding and knowledge embedding, and entity relation extraction, forming triples. These triples are then imported into the constructed knowledge graph ontology to form the knowledge graph.
[0096] Figure 3 This is a schematic diagram illustrating a domain-scalable knowledge graph construction system according to an exemplary embodiment, such as... Figure 3 As shown, it includes the following modules: an ontology construction module, which is used to construct the ontology structure of the domain knowledge graph and define the entity types, entity attribute fields and relationship types between entities contained in the domain knowledge graph.
[0097] The domain data acquisition module uses web crawling technology to obtain the raw domain data required for map construction.
[0098] The algorithm library module allows users to upload and manage algorithms through the algorithm deployment submodule; the algorithm service submodule generates API calls for each algorithm in a microservice manner; and the algorithm training submodule provides algorithm model training capabilities.
[0099] The knowledge-enhanced entity-relation extraction module calls entity recognition and relation extraction algorithms deployed in the algorithm library through the entity / relation embedding submodule to encode text tokens and text entity pair vectors; it performs joint learning of text tokens or text entity pair vectors and graph vectors through the entity / relation embedding-knowledge embedding fusion submodule; and it performs entity recognition or relation classification based on the fused vectors through the entity / relation extraction submodule to obtain triples.
[0100] The domain knowledge graph storage module stores the extracted triples.
[0101] The knowledge representation learning module uses a knowledge representation learning algorithm to generate vectors of entities and relations in the current domain knowledge graph. When the update increment of the domain knowledge graph reaches a set threshold, this module runs the knowledge representation algorithm to generate the latest entity and relation vectors.
[0102] The domain knowledge graph construction method provided in this application has good domain scalability. By generating APIs for calling various algorithms in the form of microservices, it can achieve rapid integration of algorithms and models from different domains, reducing the manpower and time costs of accessing algorithm models when applying in different domains and improving the efficiency of graph construction. Furthermore, the method of this application integrates domain knowledge into the graph construction process, enabling the knowledge extraction algorithm model to better combine with domain characteristics and improve the performance of domain knowledge extraction. It uses self-trained knowledge enhancement for domain knowledge fusion, without introducing external knowledge bases, thus reducing domain data dependence.
[0103] This application also provides a domain-scalable knowledge graph construction apparatus, which is used to execute the domain-scalable knowledge graph construction method of the above embodiments, such as... Figure 4 As shown, the device includes:
[0104] The data acquisition module 401 is used to construct the ontology structure of the domain knowledge graph and to collect domain data;
[0105] The algorithm deployment module 402 is used to deploy multiple preset algorithms required in knowledge extraction to the algorithm repository and generate the API for calling each algorithm in a microservice manner.
[0106] The construction module 403 is used to extract entities and relations from the collected domain data by calling the API of the target algorithm, form triples, import the formed triples into the ontology structure of the domain knowledge graph, and obtain the constructed domain knowledge graph.
[0107] It should be noted that the domain-scalable knowledge graph construction apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when executing the domain-scalable knowledge graph construction method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the domain-scalable knowledge graph construction apparatus and the domain-scalable knowledge graph construction method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0108] This application also provides an electronic device corresponding to the domain-scalable knowledge graph construction method provided in the foregoing embodiments, to execute the aforementioned domain-scalable knowledge graph construction method.
[0109] Please refer to Figure 5 This illustrates a schematic diagram of an electronic device provided by some embodiments of this application. For example... Figure 5 As shown, the electronic device includes: a processor 500, a memory 501, a bus 502, and a communication interface 503. The processor 500, the communication interface 503, and the memory 501 are connected via the bus 502. The memory 501 stores a computer program that can run on the processor 500. When the processor 500 runs the computer program, it executes the domain-scalable knowledge graph construction method provided in any of the foregoing embodiments of this application.
[0110] The memory 501 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 503 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.
[0111] Bus 502 can be an ISA bus, PCI bus, or EISA bus, etc. Buses can be divided into address buses, data buses, control buses, etc. Memory 501 is used to store programs. After receiving execution instructions, processor 500 executes the program. The domain-scalable knowledge graph construction method disclosed in any of the foregoing embodiments of this application can be applied to processor 500, or implemented by processor 500.
[0112] The processor 500 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 500 or by instructions in software form. The processor 500 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 501. The processor 500 reads the information in memory 501 and, in conjunction with its hardware, completes the steps of the above method.
[0113] The electronic device provided in this application embodiment and the field-scalable knowledge graph construction method provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.
[0114] This application also provides a computer-readable storage medium corresponding to the domain-scalable knowledge graph construction method provided in the foregoing embodiments. Please refer to... Figure 6 The computer-readable storage medium shown is an optical disc 600, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it executes the domain-scalable knowledge graph construction method provided in any of the foregoing embodiments.
[0115] It should be noted that examples of computer-readable storage media may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.
[0116] The computer-readable storage medium provided in the above embodiments of this application and the domain-scalable knowledge graph construction method provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.
[0117] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0118] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this patent should be determined by the appended claims.
Claims
1. A domain-scalable knowledge graph construction method, characterized in that, include: Construct the ontology structure of the domain knowledge graph and collect domain data; Deploy multiple pre-defined algorithms required for knowledge extraction into an algorithm repository, and generate API calls for each algorithm in a microservice manner; By calling the API of the target algorithm, entities and relations are extracted from the collected domain data to form triples. This includes: generating vector representations for each entity in the domain data text by calling a named entity recognition algorithm to achieve entity embedding; generating vector representations for entity pairs by calling a relation extraction algorithm to achieve relation embedding; generating knowledge vectors for entities and relations in the domain knowledge graph by calling a knowledge representation learning algorithm; jointly learning the embedded entity vectors, entity pair vectors, and knowledge vectors to obtain entity fusion vectors and entity pair fusion vectors; labeling the entity fusion vectors by calling the classifier of the named entity recognition algorithm to determine entity boundaries; classifying the entity pair fusion vectors by calling the classifier of the relation extraction algorithm to extract entity relations and form triples; and importing the formed triples into the ontology structure of the domain knowledge graph to obtain the constructed domain knowledge graph.
2. The method according to claim 1, characterized in that, Constructing the ontology structure of a domain knowledge graph includes: By defining entity types, entity attribute fields, and relationship types between entities in the domain knowledge graph, the ontology structure of the constructed domain knowledge graph is obtained.
3. The method according to claim 1, characterized in that, Deploy multiple pre-defined algorithms required for knowledge extraction into an algorithm repository, and generate API calls for each algorithm in a microservice manner, including: Upload the source code, algorithm model, and algorithm dependency files of the multiple preset algorithms required for knowledge extraction; Based on the source code, algorithm model, and algorithm dependency files of the multiple preset algorithms, they are deployed to the algorithm repository in the form of microservices, and a calling API for each algorithm is generated.
4. The method according to claim 1, characterized in that, Knowledge vectors for entities and relationships in a domain knowledge graph are generated by invoking a knowledge representation learning algorithm, including: Randomly initialize the knowledge vectors of entities and relations in the domain knowledge graph; For a triple, randomly select other entities and relations in the graph to replace the head entity, relation, and tail entity in the triple, respectively, to construct 3 negative samples; Based on the scoring function of the translation model, a loss function is constructed; The loss function is used to calculate the loss of positive sample triples and their corresponding negative sample triples. The gradient descent method is used to update the knowledge vectors of entities and relations until the number of iterations reaches the preset maximum number of iterations.
5. The method according to claim 1, characterized in that, The API for calling the target algorithm includes: Data is received and sent using the HTTP POST method, following the input format specified by the target algorithm. When it is necessary to replace the target algorithm, the algorithm can be replaced by changing the API used.
6. The method according to claim 1, characterized in that, Collect domain data, including: Collect cross-domain or target domain data through data crawling technology; The collected data is cleaned, and the text data is extracted.
7. A domain-scalable knowledge graph construction device, characterized in that, include: The data acquisition module is used to construct the ontology structure of the domain knowledge graph and collect domain data. The algorithm deployment module is used to deploy multiple preset algorithms required for knowledge extraction to the algorithm repository and generate API calls for each algorithm in a microservice manner. The construction module is used to extract entities and relations from the collected domain data by calling the API of the target algorithm, forming triples. This includes: generating vector representations for each entity in the domain data text by calling a named entity recognition algorithm to achieve entity embedding; generating vector representations for entity pairs by calling a relation extraction algorithm to achieve relation embedding; generating knowledge vectors for entities and relations in the domain knowledge graph by calling a knowledge representation learning algorithm; jointly learning the embedded entity vectors, entity pair vectors, and knowledge vectors to obtain entity fusion vectors and entity pair fusion vectors; labeling the entity fusion vectors by calling the classifier of the named entity recognition algorithm to determine entity boundaries; classifying the entity pair fusion vectors by calling the classifier of the relation extraction algorithm to extract entity relations, forming triples; and importing the formed triples into the ontology structure of the domain knowledge graph to obtain the constructed domain knowledge graph.
8. An electronic device, characterized in that, It includes a processor and a memory storing program instructions, the processor being configured to, when executing the program instructions, perform the domain-scalable knowledge graph construction method as described in any one of claims 1 to 6.
9. A computer-readable medium, characterized in that, It stores computer-readable instructions that are executed by a processor to implement a domain-scalable knowledge graph construction method as described in any one of claims 1 to 6.