Urban knowledge graph construction method and device, medium, product and equipment

By determining the text corpus data of the urban knowledge graph construction task and the target city, using a large language model to construct the city entity recognition, relationship extraction and triple extraction task instruction set, the low efficiency and scalability of urban knowledge graph construction in the existing technology are solved. The limited problem realizes the automatic construction of a general urban knowledge map, improving the construction efficiency and flexibility of application scenarios.

CN119294491APending Publication Date: 2025-01-10GUANGZHOU HKUST FOK YING TUNG RES INST
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411359007.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In the prior art, urban knowledge graph construction efficiency is low and scalable, and it is necessary to manually design maps in specific fields, resulting in high costs and limited application scenarios.

Method used

By determining the urban knowledge graph construction task and the text corpus data of the target city, using a large language model to construct the city entity recognition, relationship extraction and triple extraction task instruction sets, and automatically construct the urban knowledge graph of non-specific fields.

Benefits of technology

It improves the efficiency of urban knowledge graph construction, reduces the limitations of the graph in application scenarios, and realizes the ability of large language models to automatically build a general urban knowledge graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294491A_ABST
    Figure CN119294491A_ABST
Patent Text Reader

Abstract

The invention discloses a city knowledge graph construction method and device, a medium, a product and equipment. The method comprises the steps that a city knowledge graph construction task and city text corpus data corresponding to a target city are determined; constructing a city entity recognition task instruction set based on the city entity recognition task and the city entity knowledge data; constructing a city relation extraction task instruction set based on the city relation extraction task and the city relation knowledge data; constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data; a city entity recognition task instruction set, a city relation extraction task instruction set and a city triple extraction task instruction set are used as model input, and a city knowledge graph of a target city is constructed by using a large language model, so that the large language model can automatically construct the city knowledge graph which corresponds to the target city and is not in a specific field. The graph construction efficiency is improved, and the limitation of the knowledge graph on an application scene is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of knowledge graph technology, and in particular to a method, device, medium, product and equipment for constructing a city knowledge graph. Background Art

[0002] The urban knowledge graph is a technology that organizes and displays city-related data in the form of a graph. It can integrate data from different sources and types to form a large knowledge graph that describes various elements of the city and their relationships. This technology can provide important references for urban planning, traffic management, public safety and other fields, and can also help urban decision makers better understand the current situation and development trends of the city.

[0003] In related technologies, urban knowledge graphs in specific fields are usually constructed for specific application scenarios. For example, a knowledge graph dedicated to urban traffic flow prediction is constructed by artificially designing the traffic flow movement patterns between regions, which increases labor costs, leads to low graph construction efficiency, and limits the scalability of knowledge graphs in a wider range of application scenarios. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application propose a method, device, medium, product and equipment for constructing a city knowledge graph, which can enable a large language model to automatically construct a city knowledge graph corresponding to the target city and not a specific field, thereby improving the efficiency of graph construction and reducing the limitations of the knowledge graph in application scenarios.

[0005] In a first aspect, an embodiment of the present application provides a method for constructing a city knowledge graph, including:

[0006] Determine the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes a city entity recognition task, a city relationship extraction task and a city triple extraction task, and the city text corpus data at least includes city entity knowledge data, city relationship knowledge data and city triple knowledge data;

[0007] Based on the urban entity recognition task and the urban entity knowledge data, construct an urban entity recognition task instruction set;

[0008] Based on the city relationship extraction task and the city relationship knowledge data, construct a city relationship extraction task instruction set;

[0009] Based on the city triple extraction task and the city triple knowledge data, construct a city triple extraction task instruction set;

[0010] The city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set are used as model inputs, and a large language model is used to construct an urban knowledge graph of the target city.

[0011] Optionally, constructing a city entity recognition task instruction set based on the city entity recognition task and the city entity knowledge data includes:

[0012] Injecting the city entity recognition task and the city entity knowledge data into a preset first instruction set respectively to construct the city entity recognition task instruction set;

[0013] in,

[0014] The urban entity knowledge data includes urban space entity knowledge, time entity knowledge and functional entity knowledge;

[0015] The injected urban entity recognition task is used to define the recognition operation required to be performed on the urban entity knowledge data injected into the first instruction set, and the recognition operation includes an urban spatial entity recognition operation, a temporal entity recognition operation and a functional entity recognition operation.

[0016] Optionally, constructing a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data includes:

[0017] Injecting the city relationship extraction task and the city relationship knowledge data into a preset second instruction set respectively to construct the city relationship extraction task instruction set;

[0018] in,

[0019] The city relationship knowledge data includes city spatial relationship knowledge, time relationship knowledge and functional relationship knowledge;

[0020] The injected city relationship extraction task is used to define the relationship extraction operations that need to be performed on the city relationship knowledge data injected into the second instruction set, and the relationship extraction operations include spatial relationship extraction operations, temporal relationship extraction operations and functional relationship extraction operations.

[0021] Optionally, constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data includes:

[0022] Injecting the city triple extraction task and the city triple knowledge data into a preset third instruction set respectively to construct the city triple extraction task instruction set;

[0023] in,

[0024] The urban triplet knowledge data includes urban space triplet knowledge, time triplet knowledge and function triplet knowledge;

[0025] The injected city triple extraction task is used to define the triple recognition operation that needs to be performed on the city triple knowledge data injected into the third instruction set.

[0026] Optionally, the city knowledge graph construction task also includes a city knowledge graph completion task, and the method further includes:

[0027] Injecting the city knowledge graph completion task into a preset fourth instruction set to construct a city knowledge graph completion task instruction set;

[0028] The method uses the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and uses a large language model to construct a city knowledge graph of the target city, including:

[0029] The city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set and the city knowledge graph completion task instruction set are input into the large language model to obtain the city knowledge graph of the target city output by the large language model.

[0030] Optionally, the step of inputting the city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set, and the city knowledge graph completion task instruction set into the large language model to obtain the city knowledge graph of the target city output by the large language model includes:

[0031] Inputting the city entity recognition task instruction set into the large language model to prompt the large language model to recognize the city entity of the target city;

[0032] Inputting the city relationship extraction task instruction set into the large language model to prompt the large language model to identify the city relationship of the target city;

[0033] Inputting the city triple extraction task instruction set into the large language model to prompt the large language model to identify the city triples of the target city, so that the large language model constructs an initial city knowledge graph according to the identified city entities, city relations and city triples of the target city;

[0034] The city knowledge graph completion task instruction set is input into the large language model to prompt the large language model to complete the city relations and / or city triples of the initial city knowledge graph according to the city knowledge graph completion task to obtain the city knowledge graph of the target city.

[0035] In a second aspect, the embodiment of the present application provides a device for constructing a city knowledge graph, including:

[0036] A task and data determination module, used to determine the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes a city entity recognition task, a city relationship extraction task and a city triple extraction task, and the city text corpus data at least includes city entity knowledge data, city relationship knowledge data and city triple knowledge data;

[0037] An urban entity recognition task instruction set construction module, used to construct an urban entity recognition task instruction set based on the urban entity recognition task and the urban entity knowledge data;

[0038] A city relationship extraction task instruction set construction module, used to construct a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data;

[0039] A city triple extraction task instruction set construction module, used to construct a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data;

[0040] The city knowledge graph construction module is used to use the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and use a large language model to construct the city knowledge graph of the target city.

[0041] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the methods described above are implemented.

[0042] In a fourth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of any of the methods described above.

[0043] In a fifth aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the steps of any of the methods described above when executing the computer program.

[0044] In summary, the embodiments of the present application have at least the following beneficial effects:

[0045] According to the embodiment of the present application, by determining the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes the city entity recognition task, the city relationship extraction task and the city triple extraction task, and the city text corpus data at least includes the city entity knowledge data, the city relationship knowledge data and the city triple knowledge data; based on the city entity recognition task and the city entity knowledge data, construct a city entity recognition task instruction set; based on the city relationship extraction task and the city relationship knowledge data, construct a city relationship extraction task instruction set; based on the city triple extraction Take the task and the city triple knowledge data to construct a city triple extraction task instruction set; take the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model input, and use the large language model to construct the city knowledge graph of the target city, so that the large language model can be instructed to perform general city entity recognition, relationship extraction, and triple extraction operations according to the city knowledge graph construction task, so that the large language model can automatically construct a city knowledge graph corresponding to the target city and not in a specific field, thereby improving the efficiency of graph construction and reducing the limitations of the knowledge graph on application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a flowchart of the method for constructing a city knowledge graph provided in an embodiment of the present application;

[0047] Figure 2 It is a schematic diagram of the construction of the city knowledge graph provided in the embodiment of the present application;

[0048] Figure 3 It is a schematic diagram of the structure of the urban knowledge graph construction device provided in the embodiment of the present application;

[0049] Figure 4 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] In the description of the present application, the terms "first", "second", "third", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first", "second", "third", etc. may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more. In the description of the present application, the term "including" and its variations are open inclusions, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "according to" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments".

[0052] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0053] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as those commonly understood by those skilled in the art. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood by specific circumstances.

[0054] First, see Figure 1 , shows a schematic flow chart of a method for constructing a city knowledge graph provided in an embodiment of the present application, the method comprising steps S101-S105, which are specifically as follows:

[0055] S101, determining a city knowledge graph construction task and city text corpus data corresponding to a target city, wherein the city knowledge graph construction task includes at least a city entity recognition task, a city relationship extraction task, and a city triple extraction task, and the city text corpus data includes at least city entity knowledge data, city relationship knowledge data, and city triple knowledge data;

[0056] It should be noted that the city text corpus data in this embodiment may include text corpus used to describe various information of the target city.

[0057] It should be noted that a city triple usually refers to a three-part information structure consisting of a subject, a predicate, and an object.

[0058] S102, constructing an urban entity recognition task instruction set based on the urban entity recognition task and the urban entity knowledge data;

[0059] S103, constructing a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data;

[0060] S104, constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data;

[0061] S105, using the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and using a large language model to construct a city knowledge graph for the target city.

[0062] In one example, the large language model is trained through a sample instruction set, which includes at least a sample city entity recognition task instruction set, a sample city relationship extraction task instruction set, and a sample city triple extraction task instruction set, so that the large language model can have the ability to automatically construct a corresponding city knowledge graph using each instruction set.

[0063] In an optional implementation, the constructing of the city entity recognition task instruction set based on the city entity recognition task and the city entity knowledge data includes:

[0064] Injecting the city entity recognition task and the city entity knowledge data into a preset first instruction set respectively to construct the city entity recognition task instruction set;

[0065] in,

[0066] The urban entity knowledge data includes urban space entity knowledge, time entity knowledge and functional entity knowledge;

[0067] The injected urban entity recognition task is used to define the recognition operation required to be performed on the urban entity knowledge data injected into the first instruction set, and the recognition operation includes an urban spatial entity recognition operation, a temporal entity recognition operation and a functional entity recognition operation.

[0068] In one example, the urban entity knowledge data may include urban spatial entity knowledge, temporal entity knowledge and functional entity knowledge, wherein the urban spatial entity knowledge can be used to describe the common characteristics of the spatial entities of the target city, such as buildings, roads, parks, etc. are all spatial entities, all with spatial characteristics; temporal entity knowledge can be used to describe the common characteristics of temporal entities, such as the time points of major historical events that occurred in the target city, holidays, etc. are all temporal entities, and can all be represented as time information; functional entity knowledge can be used to describe the common characteristics of the functional entities of the target city, such as the division of urban functional areas, the functions of public facilities, etc. are all functional entities, and can all be represented as functional information. It is not difficult to understand here that the urban entity recognition task in this embodiment can be used to indicate the recognition of the spatial entities, temporal entities and functional entities of the target city in the urban entity knowledge data, wherein the spatial entities to be identified may include geographical locations (such as specific street names / addresses), temporal entities may include important time points (such as the time when historical events occurred, festivals), and functional entities may include urban functional areas (such as commercial areas, residential areas), etc.

[0069] In an optional implementation, the constructing of a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data includes:

[0070] Injecting the city relationship extraction task and the city relationship knowledge data into a preset second instruction set respectively to construct the city relationship extraction task instruction set;

[0071] in,

[0072] The city relationship knowledge data includes city spatial relationship knowledge, time relationship knowledge and functional relationship knowledge;

[0073] The injected city relationship extraction task is used to define the relationship extraction operations that need to be performed on the city relationship knowledge data injected into the second instruction set, and the relationship extraction operations include spatial relationship extraction operations, temporal relationship extraction operations and functional relationship extraction operations.

[0074] In one example, the city relationship knowledge data includes city spatial relationship knowledge (such as the adjacency relationship between streets and buildings), temporal relationship knowledge (such as the order of events), and functional relationship knowledge (such as the relationship between a hospital and the community it serves). It is not difficult to understand that the city relationship extraction task in this embodiment is used to indicate the city spatial relationship knowledge, temporal relationship knowledge, and functional relationship knowledge of the target city extracted from the city entity knowledge data.

[0075] In an optional implementation, the step of constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data includes:

[0076] Injecting the city triple extraction task and the city triple knowledge data into a preset third instruction set respectively to construct the city triple extraction task instruction set;

[0077] in,

[0078] The urban triplet knowledge data includes urban space triplet knowledge, time triplet knowledge and function triplet knowledge;

[0079] The injected city triple extraction task is used to define the triple recognition operation that needs to be performed on the city triple knowledge data injected into the third instruction set.

[0080] In one example, the city triple knowledge data may include city space triple knowledge (e.g., "hospital-located-street"), time triple knowledge (e.g., "event-occurred-at-time"), and function triple knowledge. It is not difficult to understand that the city triple extraction task in this embodiment can be used to instruct to extract the city space triple knowledge, time triple knowledge, and function triple knowledge of the target city from the city entity knowledge data, for example, it can refer to extracting "a certain bridge-built-in-a certain year" from the news reports of the target city (i.e., some examples of the city triple knowledge data) to form a complete triple information unit.

[0081] In an optional implementation, the city knowledge graph construction task also includes a city knowledge graph completion task, and the method further includes:

[0082] The city knowledge graph completion task is injected into the preset fourth instruction set to construct a city knowledge graph completion task instruction set.

[0083] The method uses the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and uses a large language model to construct a city knowledge graph of the target city, including:

[0084] The city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set and the city knowledge graph completion task instruction set are input into the large language model to obtain the city knowledge graph of the target city output by the large language model.

[0085] In one example, the large language model is trained by a sample instruction set, which includes a sample city entity recognition task instruction set, a sample city relationship extraction task instruction set, a sample city triple extraction task instruction set, and a sample city knowledge graph completion task instruction set, so that the large language model can automatically construct the corresponding city knowledge graph using the above instruction sets. For example, see Figure 2 The capabilities of this large language model.

[0086] In an optional implementation, the step of inputting the city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set, and the city knowledge graph completion task instruction set into the large language model to obtain the city knowledge graph of the target city output by the large language model includes:

[0087] Inputting the city entity recognition task instruction set into the large language model to prompt the large language model to recognize the city entity of the target city;

[0088] Inputting the city relationship extraction task instruction set into the large language model to prompt the large language model to identify the city relationship of the target city;

[0089] Inputting the city triple extraction task instruction set into the large language model to prompt the large language model to identify the city triples of the target city, so that the large language model constructs an initial city knowledge graph according to the identified city entities, city relations and city triples of the target city;

[0090] The city knowledge graph completion task instruction set is input into the large language model to prompt the large language model to complete the city relations and / or city triples of the initial city knowledge graph according to the city knowledge graph completion task to obtain the city knowledge graph of the target city.

[0091] In one example, city relationship completion may include: completing missing city entity relationships by adding implicit relationships based on reasoning. City triple completion may include: completing information in the knowledge graph by performing logical deduction based on existing triples.

[0092] For example, if you know that a public figure is involved in a project and that the project is related to a construction company, you can supplement the potential connection between the public figure and the company through logical reasoning.

[0093] On the second aspect, accordingly, the embodiment of the present application also provides a city knowledge graph construction device, which can implement all the processes of the city knowledge graph construction method provided in the above embodiment.

[0094] See also Figure 3 , shows a schematic diagram of the structure of a city knowledge graph construction device provided in an embodiment of the present application, the city knowledge graph construction device comprising:

[0095] The task and data determination module 301 is used to determine the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes the city entity recognition task, the city relationship extraction task and the city triple extraction task, and the city text corpus data at least includes the city entity knowledge data, the city relationship knowledge data and the city triple knowledge data;

[0096] An urban entity recognition task instruction set construction module 302 is used to construct an urban entity recognition task instruction set based on the urban entity recognition task and the urban entity knowledge data;

[0097] A city relationship extraction task instruction set construction module 303 is used to construct a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data;

[0098] A city triple extraction task instruction set construction module 304 is used to construct a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data;

[0099] The city knowledge graph construction module 305 is used to use the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and use a large language model to construct the city knowledge graph of the target city.

[0100] In an optional implementation, the constructing of the city entity recognition task instruction set based on the city entity recognition task and the city entity knowledge data includes:

[0101] Injecting the city entity recognition task and the city entity knowledge data into a preset first instruction set respectively to construct the city entity recognition task instruction set;

[0102] in,

[0103] The urban entity knowledge data includes urban space entity knowledge, time entity knowledge and functional entity knowledge;

[0104] The injected urban entity recognition task is used to define the recognition operation required to be performed on the urban entity knowledge data injected into the first instruction set, and the recognition operation includes an urban spatial entity recognition operation, a temporal entity recognition operation and a functional entity recognition operation.

[0105] In an optional implementation, the constructing of a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data includes:

[0106] Injecting the city relationship extraction task and the city relationship knowledge data into a preset second instruction set respectively to construct the city relationship extraction task instruction set;

[0107] in,

[0108] The city relationship knowledge data includes city spatial relationship knowledge, time relationship knowledge and functional relationship knowledge;

[0109] The injected city relationship extraction task is used to define the relationship extraction operations that need to be performed on the city relationship knowledge data injected into the second instruction set, and the relationship extraction operations include spatial relationship extraction operations, temporal relationship extraction operations and functional relationship extraction operations.

[0110] In an optional implementation, the step of constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data includes:

[0111] Injecting the city triple extraction task and the city triple knowledge data into a preset third instruction set respectively to construct the city triple extraction task instruction set;

[0112] in,

[0113] The urban triplet knowledge data includes urban space triplet knowledge, time triplet knowledge and function triplet knowledge;

[0114] The injected city triple extraction task is used to define the triple recognition operation that needs to be performed on the city triple knowledge data injected into the third instruction set.

[0115] In an optional implementation, the city knowledge graph construction task also includes a city knowledge graph completion task, and the device further includes:

[0116] A city knowledge graph completion task instruction set construction module, used for injecting the city knowledge graph completion task into a preset fourth instruction set to construct a city knowledge graph completion task instruction set;

[0117] The method uses the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and uses a large language model to construct a city knowledge graph of the target city, including:

[0118] The city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set and the city knowledge graph completion task instruction set are input into the large language model to obtain the city knowledge graph of the target city output by the large language model.

[0119] In an optional implementation, the step of inputting the city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set, and the city knowledge graph completion task instruction set into the large language model to obtain the city knowledge graph of the target city output by the large language model includes:

[0120] Inputting the city entity recognition task instruction set into the large language model to prompt the large language model to recognize the city entity of the target city;

[0121] Inputting the city relationship extraction task instruction set into the large language model to prompt the large language model to identify the city relationship of the target city;

[0122] Inputting the city triple extraction task instruction set into the large language model to prompt the large language model to identify the city triples of the target city, so that the large language model constructs an initial city knowledge graph according to the identified city entities, city relations and city triples of the target city;

[0123] The city knowledge graph completion task instruction set is input into the large language model to prompt the large language model to complete the city relations and / or city triples of the initial city knowledge graph according to the city knowledge graph completion task to obtain the city knowledge graph of the target city.

[0124] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the methods described above are implemented.

[0125] In a fourth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of any of the methods described above.

[0126] In a fifth aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the steps of any of the methods described above when executing the computer program.

[0127] See also Figure 4The computer device of this embodiment includes: a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401, such as a city knowledge graph construction program. When the processor 401 executes the computer program, the steps in the above-mentioned city knowledge graph construction method embodiments are implemented, such as Figure 1 Steps S101-S105 are shown.

[0128] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the computer device.

[0129] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0130] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor 401 may also be any conventional processor, etc. The processor 401 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device.

[0131] The memory 402 can be used to store the computer program and / or module, and the processor 401 realizes various functions of the computer device by running or executing the computer program and / or module stored in the memory 402, and calling the data stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0132] Wherein, if the module / unit integrated in the computer device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 401. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0133] In summary, the embodiments of the present application have at least the following beneficial effects:

[0134] According to the embodiment of the present application, by determining the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes the city entity recognition task, the city relationship extraction task and the city triple extraction task, and the city text corpus data at least includes the city entity knowledge data, the city relationship knowledge data and the city triple knowledge data; based on the city entity recognition task and the city entity knowledge data, construct a city entity recognition task instruction set; based on the city relationship extraction task and the city relationship knowledge data, construct a city relationship extraction task instruction set; based on the city triple extraction Take the task and the city triple knowledge data to construct a city triple extraction task instruction set; take the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model input, and use the large language model to construct the city knowledge graph of the target city, so that the large language model can be instructed to perform general city entity recognition, relationship extraction, and triple extraction operations according to the city knowledge graph construction task, so that the large language model can automatically construct a city knowledge graph corresponding to the target city and not in a specific field, thereby improving the efficiency of graph construction and reducing the limitations of the knowledge graph on application scenarios.

[0135] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary hardware platform, and of course, it can also be implemented entirely by hardware. Based on such an understanding, all or part of the contribution of the technical solution of the present application to the background technology can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0136] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.

Claims

1. A method for constructing a city knowledge graph, characterized in that: include: Determine the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes a city entity recognition task, a city relationship extraction task and a city triple extraction task, and the city text corpus data at least includes city entity knowledge data, city relationship knowledge data and city triple knowledge data; Based on the urban entity recognition task and the urban entity knowledge data, construct an urban entity recognition task instruction set; Based on the city relationship extraction task and the city relationship knowledge data, construct a city relationship extraction task instruction set; Based on the city triple extraction task and the city triple knowledge data, construct a city triple extraction task instruction set; The city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set are used as model inputs, and a large language model is used to construct an urban knowledge graph of the target city.

2. The method according to claim 1, characterized in that The step of constructing a city entity recognition task instruction set based on the city entity recognition task and the city entity knowledge data includes: Injecting the city entity recognition task and the city entity knowledge data into a preset first instruction set respectively to construct the city entity recognition task instruction set; in, The urban entity knowledge data includes urban space entity knowledge, time entity knowledge and functional entity knowledge; The injected urban entity recognition task is used to define the recognition operation required to be performed on the urban entity knowledge data injected into the first instruction set, and the recognition operation includes an urban spatial entity recognition operation, a temporal entity recognition operation and a functional entity recognition operation.

3. The method according to claim 1, characterized in that The step of constructing a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data includes: Injecting the city relationship extraction task and the city relationship knowledge data into a preset second instruction set respectively to construct the city relationship extraction task instruction set; in, The city relationship knowledge data includes city spatial relationship knowledge, time relationship knowledge and functional relationship knowledge; The injected city relationship extraction task is used to define the relationship extraction operations that need to be performed on the city relationship knowledge data injected into the second instruction set, and the relationship extraction operations include spatial relationship extraction operations, temporal relationship extraction operations and functional relationship extraction operations.

4. The method according to claim 1, characterized in that The step of constructing a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data includes: Injecting the city triple extraction task and the city triple knowledge data into a preset third instruction set respectively to construct the city triple extraction task instruction set; in, The urban triplet knowledge data includes urban space triplet knowledge, time triplet knowledge and function triplet knowledge; The injected city triple extraction task is used to define the triple recognition operation that needs to be performed on the city triple knowledge data injected into the third instruction set.

5. The method according to any one of claims 1 to 4, characterized in that: The city knowledge graph construction task also includes a city knowledge graph completion task, and the method further includes: Injecting the city knowledge graph completion task into a preset fourth instruction set to construct a city knowledge graph completion task instruction set; The method uses the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and uses a large language model to construct a city knowledge graph of the target city, including: The city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set and the city knowledge graph completion task instruction set are input into the large language model to obtain the city knowledge graph of the target city output by the large language model.

6. The method according to claim 5, characterized in that The step of inputting the city entity recognition task instruction set, the city relationship extraction task instruction set, the city triple extraction task instruction set, and the city knowledge graph completion task instruction set into the large language model to obtain the city knowledge graph of the target city output by the large language model includes: Inputting the city entity recognition task instruction set into the large language model to prompt the large language model to recognize the city entity of the target city; Inputting the city relationship extraction task instruction set into the large language model to prompt the large language model to identify the city relationship of the target city; Inputting the city triple extraction task instruction set into the large language model to prompt the large language model to identify the city triples of the target city, so that the large language model constructs an initial city knowledge graph according to the identified city entities, city relations and city triples of the target city; The city knowledge graph completion task instruction set is input into the large language model to prompt the large language model to complete the city relations and / or city triples of the initial city knowledge graph according to the city knowledge graph completion task to obtain the city knowledge graph of the target city.

7. A device for constructing a city knowledge graph, characterized in that: include: A task and data determination module, used to determine the city knowledge graph construction task and the city text corpus data corresponding to the target city, wherein the city knowledge graph construction task at least includes a city entity recognition task, a city relationship extraction task and a city triple extraction task, and the city text corpus data at least includes city entity knowledge data, city relationship knowledge data and city triple knowledge data; An urban entity recognition task instruction set construction module, used to construct an urban entity recognition task instruction set based on the urban entity recognition task and the urban entity knowledge data; A city relationship extraction task instruction set construction module, used to construct a city relationship extraction task instruction set based on the city relationship extraction task and the city relationship knowledge data; A city triple extraction task instruction set construction module, used to construct a city triple extraction task instruction set based on the city triple extraction task and the city triple knowledge data; The city knowledge graph construction module is used to use the city entity recognition task instruction set, the city relationship extraction task instruction set and the city triple extraction task instruction set as model inputs, and use a large language model to construct the city knowledge graph of the target city.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program.

Citation Information

Cited By

  • Multi-stage collaborative urban physical examination knowledge reasoning method and related equipment

    CN119476507A

  • City block form optimization design decision-making method and system based on generation of large model

    CN119885386A