Address search method and system based on spatial relation knowledge graph enhanced LLM

Through the combination of large language model and spatial relationship knowledge graph, the problems of low query efficiency and high threshold in traditional geographical information systems are solved, and efficient understanding and accurate query of complex spatial relationships are achieved.

CN120407606AInactive Publication Date: 2025-08-01WUHAN UNIV

Patent Information

Application Number
CN202510913198.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-08-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional geographical information systems are inefficient and have high thresholds when handling complex spatial relationship queries, and existing methods cannot accurately reflect the spatial relationships in the user's natural language.

Method used

The large language model (LLM) is used to combine the spatial relationship knowledge graph, and natural language query statements are structured, spatial entities and relationships are extracted, structured query statements are generated, and matching and querying are performed in the knowledge graph.

Benefits of technology

It improves the query efficiency and accuracy of the geographic information system, lowers the threshold for use, and allows users to obtain geospatial data without professional skills.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407606A_ABST
    Figure CN120407606A_ABST
Patent Text Reader

Abstract

In order to improve the efficiency and accuracy of place name address search in a complex semantic environment, the invention discloses an address search method for enhancing LLM based on a spatial relation knowledge graph. According to the method, place name addresses and related information contained in a Chinese natural language under complex semantics (nested spatial relationship semantics) can be converted into spatial positions of the addresses or geographic entities related to the positions. According to the method, geographical name and address information extraction in a Chinese natural language is focused on, and complex spatial relationship semantic geographical name and address contained in the Chinese natural language are analyzed by utilizing the analysis capability of a large language model on the Chinese natural language and are organized into structured parameters; then converting the structured parameters into a retrieval instruction stream of spatial data through a spatial relationship knowledge graph; therefore, the corresponding geographic position and the geographic object associated with the position are obtained. According to the method, a Chinese natural language geographic information retrieval function module is constructed based on the method, and the practicability of the process is verified by utilizing a query example.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent interaction, and particularly to a natural language interaction method for a geographic information system, specifically an address search method and system based on a spatial relationship knowledge graph to enhance the LLM. Background Art

[0002] As GIS gradually develops towards the direction of geographic information services, GIS has more and more application scenarios in real life. The realization of GIS popularization requires reducing the usage threshold of the developed applications or platforms.

[0003] In today's data-driven world, it is very important to store and use data, and database interaction languages play a key role in data management. However, understanding database schemas and performing query operations require certain technical capabilities, which will bring a relatively high learning cost for non-professional workers.

[0004] Existing map navigation software or geographic information system platforms have certain limitations in processing complex spatial queries. Specifically, when users need to perform queries based on spatial relationships, they only rely on simple word segmentation matching methods, resulting in the inability of the results to accurately reflect the spatial relationships in the statements. Therefore, in order to improve the application efficiency and user experience of geographic information systems, it is necessary to further research and develop technologies and tools that can better understand and process spatial relationships.

[0005] With the wide use of large language models (LLMs) and knowledge graphs, the demand for using natural language to query spatial entities and output corresponding results has become increasingly urgent. In the past period of time, certain progress has been made in address search based on traditional natural language processing. However, with the continuous update and iteration of large language models, using large language models to achieve the mapping from natural language to query statements will become a new direction.

[0006] The meanings of the terms mentioned in the specification of the present invention are as follows: LLM: Large Language Model, a large language model; GIS: Geographic Information System, a geographic information system. Summary of the Invention

[0007] To solve the problems of low query efficiency, high query threshold, and insufficient support for queries with complex spatial relationships in traditional geographic information system queries, the present invention provides an address search method based on a spatial relationship knowledge graph to enhance the large language model (LLM). By leveraging the capabilities of the large language model and performing knowledge alignment through the knowledge graph, the geographic information system can better understand natural language, thereby improving the intelligent interaction experience when users use the geographic information system.

[0008] According to one aspect of the specification of the present invention, there is provided an address search method based on a spatial relationship knowledge graph to enhance the LLM, including: Using the large language model to perform structured processing on the natural language query statement, extracting the spatial entities, spatial relationships, and query intentions therein, and generating corresponding structured data; Constructing a spatial relationship knowledge graph, where the spatial relationship knowledge graph includes geospatial entities, surveying and mapping archive data, and spatial relationships; Matching the generated structured data with the spatial relationship knowledge graph, obtaining a structured query statement template, and generating a final structured query statement; Executing the structured query statement in the spatial database and returning the query result.

[0009] As a further technical solution, the use of the large language model to perform structured processing on the natural language query statement includes: Preprocessing the natural language query statement; Based on the semantic understanding ability of the large language model, extracting the spatial entities, spatial relationships, and query intentions in the natural language query statement; Organizing the extracted information into a structured data format according to a preset structured template.

[0010] As a further technical solution, the construction of the spatial relationship knowledge graph includes: Designing an ontology library for the spatial relationship knowledge graph, including entity concepts and their attributes, and relationship types and their attributes; Performing knowledge extraction on the spatial entity and surveying and mapping archive data parts from structured geospatial data and surveying and mapping archive data, and obtaining geospatial entities, surveying and mapping archive data, and related attribute information; From unstructured text data, combining geographical information professional knowledge, and completing the knowledge extraction of the spatial relationship part with the assistance of the large language model; Performing knowledge fusion, realizing entity alignment according to the entity-concept mapping table, and storing the existing knowledge in the graph database to form a spatial relationship knowledge graph.

[0011] As a further technical solution, the matching of the generated structured data with the spatial relationship knowledge graph includes: Identify and extract spatial entities and spatial relationships in structured data; Search in the knowledge graph for nodes and paths that match the extracted spatial entities and spatial relationships; Based on the matching results, obtain the corresponding structured query statement template and parameter information.

[0012] As a further technical solution, generating the final structured query statement and performing a query operation includes: Replace the parameters in the structured query statement template with the corresponding values in the structured data; Generate a complete structured query statement according to the query intent and parameter information; Execute the generated structured query statement in the spatial database, obtain the query result, and return it to the user.

[0013] According to one aspect of the specification of the present invention, there is provided an address search system for enhancing an LLM based on a spatial relationship knowledge graph, including: A natural language processing module for using a large language model to structurally process natural language query statements, extract spatial entities, spatial relationships, and query intent therein, and generate corresponding structured data; A knowledge graph construction module for constructing a spatial relationship knowledge graph, where the spatial relationship knowledge graph includes geospatial entities, surveying and mapping archive data, and spatial relationships; A query statement generation module for matching the generated structured data with the spatial relationship knowledge graph, obtaining a structured query statement template, and generating a final structured query statement; A database query module for executing a structured query statement in a spatial database and returning a query result.

[0014] As a further technical solution, the knowledge graph construction module includes: An ontology library design unit for designing the ontology library of the spatial relationship knowledge graph, including entity concepts and their attributes and relationship types and their attributes; A knowledge extraction unit for extracting knowledge related to spatial entities, surveying and mapping archive data, and spatial relationships from structured and unstructured data; A knowledge fusion unit for realizing entity alignment based on an entity-concept mapping table and storing the knowledge in a graph database to form a spatial relationship knowledge graph.

[0015] As a further technical solution, the natural language processing module includes: A preprocessing unit for preprocessing natural language query statements; A semantic understanding unit for understanding the semantics of query statements based on a large language model and extracting spatial entities, spatial relationships, and query intents therein; A structured generation unit for organizing the extracted information into a structured data format according to a preset template.

[0016] As a further technical solution, the query statement generation module includes: A matching unit for matching the structured data with a knowledge graph to obtain corresponding structured query statement templates and parameter information; A replacement unit for replacing the parameters in the structured query statement template with the values in the structured data to generate a complete query statement.

[0017] According to one aspect of the specification of the present invention, a non-transitory computer-readable storage medium is provided. The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions cause the computer to execute the address search method based on a spatial relationship knowledge graph that enhances the LLM.

[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By introducing the powerful natural language processing ability of a large language model and combining the structured knowledge representation of a knowledge graph, the present invention constructs an efficient spatial entity semantic search system, which solves the problems of low query efficiency, high query threshold, and insufficient support for queries with complex spatial relationships in traditional geographic information system queries. The large language model can accurately understand the semantic information in the user's natural language query, including spatial entities, spatial relationships, and query intents, etc., while the knowledge graph provides a clear structured mapping for these semantic information, enabling the system to quickly generate accurate structured query statements, so that users can easily obtain the required geospatial data without professional skills, significantly reducing the usage threshold of the geographic information system.

[0019] 2. The present invention integrates the knowledge graph into the spatial entity semantic search process, improving the accuracy and efficiency of geographic information system queries. The knowledge graph stores rich geospatial knowledge in a structured form, including spatial entities, spatial relationships, and surveying and mapping archive data, etc., providing a solid knowledge basis for the generation of query statements. After understanding the user's query statement, the large language model can quickly match the corresponding structured information from the knowledge graph, and then generate an efficient structured query statement, avoiding the problem of low query efficiency caused by complex rules and cumbersome reasoning processes in traditional methods, greatly improving the query efficiency, being able to quickly respond to the user's query request, providing timely and accurate geospatial data for the user, and enhancing the overall performance of the geographic information system. Description of the Drawings

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.

[0021] Figure 1 It is a flowchart of the implementation of an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0022] Figure 2 It is an example of a rule template for an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0023] Figure 3 It is an example of a training set for an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0024] Figure 4 It is a flowchart of the construction of a spatial knowledge graph for an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0025] Figure 5 It is a flowchart of an embodiment of an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0026] Figure 6 It is a schematic diagram of the results of an embodiment of an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0027] Figure 7 It is an example of semantic structuring for an address search method for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention.

[0028] Figure 8 It is a schematic diagram of an address search system for enhancing LLM based on a spatial relationship knowledge graph provided by an embodiment of the present invention. Detailed implementation manners

[0029] To improve the efficiency and accuracy of place name and address search in complex semantic environments, the present invention discloses an address search method based on a spatial relationship knowledge graph to enhance the ChatGLM pre-trained model (LLM). This method can convert the place names, addresses, and related information contained in Chinese natural language under complex semantics (nested spatial relationship semantics) into the spatial positions of addresses or geographical entities related to positions. The present invention focuses on the extraction of place name and address information in Chinese natural language, and uses the parsing ability of the large language model for Chinese natural language to parse the place names and addresses with complex spatial relationship semantics contained therein and organize them into structured parameters; then converts the structured parameters into a retrieval instruction stream of spatial data through the spatial relationship knowledge graph; thereby obtaining the corresponding geographical location and the geographical objects associated with that location. The present invention constructs a Chinese natural language geographical information retrieval function module based on this method and verifies the practicability of this process using query examples.

[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention. In addition, the technical features in each embodiment or individual embodiment provided by the present invention can be combined with each other arbitrarily to form a new technical solution. This combination is not restricted by the order of steps and / or the pattern of structural composition, but must be based on the fact that those of ordinary skill in the art can implement it. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.

[0031] In current geographical information service platforms, for spatial entity search queries, more are based on text matching rather than spatial semantic relationships, which results in the spatial characteristics of query results not being fully expressed. This is because traditional address search methods mainly rely on the similarity comparison of text vectors and lack the ability to parse and express complex semantics in natural language. Especially in understanding spatial relationships, there are certain deficiencies, resulting in query results often being unable to accurately reflect the spatial relationships in the statements.

[0032] To overcome the above technical problems, the embodiments of the present invention disclose a natural language interaction method for a geographical information system, that is, an address search method based on a spatial relationship knowledge graph to enhance the LLM, which can utilize the capabilities of the language model to enable the geographical information system to better understand natural language, thereby improving the intelligent interaction experience when users use the geographical information system.

[0033] See Figure 1 As shown, the overall technical framework of the embodiments of the present invention includes: Step S1, rule template construction. In the embodiments of the present invention, there is currently no directly usable training set, so it is necessary to collect manually or generate the training set with the help of code, and the rule template is the prerequisite for subsequent data set construction. Before constructing the rule template, the embodiments of the present invention classify the spatial entity query statements according to two classification methods: "query intention" and "spatial relationship". According to the spatial relationship, it is mainly divided into 6 types: inclusion, relative orientation, separation, intersection, connection and nesting relationship; according to the query intention, it is mainly divided into 5 types: querying geographical elements, querying archives, judgment, judging orientation and querying distance.

[0034] The following is for Figure 2 the template in, and the parameter description is as follows: "text" represents the query statement input by the user; "Address description" represents the morphemes related to spatial entity search initially extracted by the large language model; In this query statement, A is the "reference element" of the spatial relationship, and B is the "target element" to be queried; "Intention" and "target data" indicate that the purpose of the query is to obtain the geographical geometric data of B; The "scale" parameter only plays a role in queries related to distance, such as relationships like "nearby" or "distance".

[0035] Formulating the rule template can ensure that the large language model reasonably outputs structured information parameters. Subsequently, these parameters are passed to the knowledge graph, and the query of elements can be realized by parameter matching through the knowledge graph.

[0036] Step S2, construction of a fine-tuning data set for complex spatial relationship corpora. After the template construction is completed, a data set can be constructed with the help of a python script.

[0037] The fine-tuning data set is mainly based on the existing place name and address library. Based on the rule template, through a python script, place names and addresses are extracted from the place name and address library and filled into the template to complete the construction of the data set. See Figure 3 As shown, in the embodiments of the present invention, 117 templates are constructed, and 20,000 pieces of data are generated through a program, of which 18,000 are divided into the training set and 2,000 are divided into the test set.

[0038] Step S3, model fine-tuning. Since ChatGLM is a general large language model and cannot well complete the task of information extraction in spatial entity statements, fine-tuning is required to make it adapt to the information extraction task.

[0039] Fine-tuning of large language models refers to the process of personalizing or task-specific adjustment of pre-trained large language models (such as GPT, GLM). Generally, large language models are pre-trained on large-scale text data to learn the structure, grammar, semantics, etc. of the language. However, for specific tasks or domains, the model needs to be more professional or targeted. Fine-tuning is for this purpose.

[0040] Current fine-tuning paradigms for large language models mainly include methods such as Adapter Tuning, LORA, Prefix-Tuning, Prompt Tuning, P-Tuning, P-Tuning v2, etc.

[0041] P-Tuning v2 is a fine-tuning method exclusive to the ChatGLM model. It is an efficient parameter fine-tuning scheme and is also the fine-tuning method adopted in the embodiments of the present invention. It achieves efficient fine-tuning by adjusting the prefix part of the model parameters, thereby reducing the computational cost while maintaining the model performance. The core idea of P-Tuning v2 is to update only a part of the model parameters during the fine-tuning process, rather than updating all of them. The trainable parameters for each task in P-Tuning v2 are reduced to 0.1% to 3%, which greatly reduces the memory consumption during training and the storage cost for each task. This can greatly reduce the computational amount and storage requirements while ensuring the model performance.

[0042] In the embodiments of the present invention, the model fine-tuning includes the following steps: S3.1. Prepare the dataset: Collect and prepare a fine-tuning dataset with complex spatial relation corpus. Since there is no suitable publicly available dataset for the embodiments of the present invention, the fine-tuning dataset needs to be constructed with the assistance of a program.

[0043] S3.2. Select the model: Select a pre-trained model suitable for the task. In the embodiments of the present invention, the open-source ChatGLM4-9B is selected as the basic model. Generally, models of different scales can be selected according to the complexity of the task and the available computing resources. Currently, open-source large language models at home and abroad can all achieve fine-tuning for specific tasks. The method disclosed in the present invention only requires a basic model with a relatively small number of parameters (such as 9B) to achieve the final query retrieval function.

[0044] S3.3. Fine-tuning settings: Determine the fine-tuning parameters and settings, such as the learning rate, batch size, etc. These settings will affect the fine-tuning effect to a certain extent. The setting of fine-tuning parameters needs to be comprehensively considered based on various aspects such as the size, quality, and resources of the training set.

[0045] S3.4, Fine-tuning the model: Load the ChatGLM4-9B model into the environment and fine-tune the model using a fine-tuning dataset with complex spatial relation corpus. The fine-tuning process usually includes multiple iterations, and the model gradually adjusts its parameters according to the feedback of the dataset.

[0046] S3.5, Evaluating performance: Use methods such as the evaluation set or cross-validation to evaluate the performance of the fine-tuned model. This can help determine whether the fine-tuning is successful and whether further adjustment of the model or parameters is needed.

[0047] S3.6, Deployment and application: The ChatGLM4-9B model fine-tuned with a fine-tuning dataset with complex spatial relation corpus can already complete the work of extracting and structuring information in natural language. Deploy the fine-tuned model into practical applications and monitor its performance in the real environment. The deployment process needs to consider factors such as the speed and resource consumption of the model.

[0048] Large language model fine-tuning is widely used in the field of natural language processing, including tasks such as text generation, sentiment analysis, and question answering systems. Through fine-tuning, the model can better adapt to the needs of specific fields or tasks, and improve the effectiveness and performance of the model in practical applications.

[0049] Preset the number of fine-tuning steps of the model, and the pre-trained model can be fine-tuned after the model is deployed.

[0050] The common point of both Lora fine-tuning and P-Tuning v2 fine-tuning for fine-tuning large models with low resources is to freeze the parameters of the large model and learn the low-rank changes generated by fine-tuning through small modules. However, some existing problems are that these two training methods are prone to catastrophic forgetting of parameters. Because when the model is fine-tuned, the parameters of the entire model layer do not change, while the learnable module with few parameters has a huge change during fine-tuning, which is likely to cause a large bias in the model during inference, making the previous answering ability deviated by the learnable module. For catastrophic forgetting of the pre-trained model, on the one hand, general learning corpus can be added to the fine-tuning corpus for joint fine-tuning to avoid a great bias towards the fine-tuning corpus, which can alleviate this forgetting problem to a certain extent.

[0051] When dealing with complex tasks with limited samples but requiring a powerful model, overfitting is likely to occur. This phenomenon is manifested as the model performing well on the training set but poorly on the validation set or test set. When fine-tuning the model, it is also necessary to note that overfitting the fine-tuning data should be avoided, otherwise it will lead to the loss of the original pre-trained knowledge and catastrophic forgetting. Therefore, the performance of the validation set can be monitored during the training process, and the training can be stopped when the performance of the validation set no longer improves to prevent the model from overfitting on the training data.

[0052] Step S4: Construction of the spatial knowledge graph. After the user inputs a Chinese spatial entity query statement, the program will use the information extraction function fine-tuned by ChatGLM to structure the query statement into json, which contains parameters such as entities, relationships, and query purposes. After obtaining these parameters, the final spatial element query is completed based on the knowledge graph.

[0053] Similar to general knowledge graphs, the spatial relationship knowledge graph is also mainly divided into the construction of the schema layer and the data layer. The schema layer mainly includes the spatial relationship ontology library, while the data layer mainly includes geospatial entities and geospatial relationships. In this study, in addition to geospatial entities, it also includes surveying and mapping archive data, and spatial relationships are also regarded as an entity node in the knowledge graph.

[0054] In the embodiment of the present invention, a top-down method is adopted, with the currently commonly used graph database Neo4j as the platform, and the construction of the schema layer and the data layer of the spatial relationship knowledge graph is completed through geospatial ontology library construction, knowledge extraction, knowledge fusion, knowledge update, etc.

[0055] See Figure 4 As shown, the construction process of the spatial relationship knowledge graph is as follows: S4.1: First, for the existing structured and unstructured data structures, a suitable knowledge expression method is proposed, that is, the entity concepts, their attributes, relationship types, and their attributes of the spatial relationship knowledge graph are designed to form the ontology library of the knowledge graph, and the construction of the schema layer is completed.

[0056] S4.2: Secondly, knowledge extraction of the spatial entity and surveying and mapping archive data parts is carried out from the structured geospatial data and surveying and mapping archive data to obtain geospatial entities, surveying and mapping archive data, and related attribute information; at the same time, knowledge extraction of the spatial relationship part is completed from a large amount of unstructured text data with the assistance of a generative pre-trained model. After knowledge extraction, an entity concept mapping table of spatial entities, surveying and mapping archive data, and spatial relationships is constructed to realize the concept classification of entities; at the same time, relatively simple relationships between entities are established.

[0057] S4.3: Then, knowledge fusion is carried out, mainly to achieve entity alignment based on the entity-concept mapping table. Then, the existing knowledge is stored in the graph database, and a relatively complete spatial relationship knowledge graph can be formed; while the structured data related to detailed spatial information and archive information is stored in the spatial database.

[0058] S4.4: Finally, the spatial relationship knowledge graph should be continuously expanded, that is, knowledge update is required. This requires storing the entity nodes that fail to match separately during the subsequent search service process to wait for manual intervention.

[0059] Step S5: Construction of Spatial Entity Semantic Search Application. With the information extraction function of the fine-tuned ChatGLM, construct the backend API interface to complete the construction of the spatial entity semantic search application, mainly including the production of Web pages and the query of the backend database, etc.

[0060] See Figure 5 As shown, after fine-tuning, merge the model weights into the ChatGLM4 base model to obtain a model specifically for spatial entity semantic search. Integrate this model into the project backend in the form of an API, return the information parameters extracted by the large model through the backend, and then pass these information parameters to the knowledge graph. Based on the knowledge graph, match the parameters and automatically generate corresponding query statements to query the place name address database, and finally return the data to the user.

[0061] S5.1: The user inputs "POI points near the intersection of Road A and Road B".

[0062] See Figure 6 As shown, after the user enters the query statement in the search box and clicks the "Query" button, the query parameters can be passed to the backend.

[0063] S5.2: Obtain the request text and forward it to the large language model for semantic structuring. See Figure 7 As shown.

[0064] S5.3: Input the structured parameters into the knowledge graph to construct the corresponding query statement.

[0065] First, call the Neo4jQuery() function of the Neo4jQuery class to query in the knowledge graph to achieve entity alignment. One is the spatial entity, mainly to help determine the table name and distance scale; the second is the spatial relationship; the third is the query intention, which further aligns the intention nodes through the intend_to relationship on the basis of the aligned spatial relationship and obtains the SQL template statement, waiting for parameter passing. If the spatial relationship cannot be found, terminate the program, return it and store it in a unified table, waiting for manual intervention to update the graph.

[0066] Then, call the pgSQL() function in the pgSQLConnection class, and pass the obtained table name, entity name, distance parameters, etc. as parameters into the SQL template statement, and execute the corresponding query in the PostgreSQL database. If it is necessary to query archive data, call the pgSQLarc() function.

[0067] If there is a nested query, it is necessary to call the inNeo4jQuery() function to perform a graph database query. The subsequent spatial database query process is the same as above, but entity A will be represented by the result of the previous query.

[0068] Finally, process the final query result and return it to the front end to complete the query between the graph database and the spatial database.

[0069] S5.4. Perform front-end rendering and display of the query results. Refer to Figure 6 as shown.

[0070] The implementation basis of each embodiment of the present invention is achieved through programmed processing by a device with processor functions. Therefore, in engineering practice, the technical solutions and functions of each embodiment of the present invention are encapsulated into various modules. Based on this reality, on the basis of the above embodiments, an embodiment of the present invention provides an address search system for enhancing LLM based on a spatial relationship knowledge graph, which is used to execute the address search method for enhancing LLM based on a spatial relationship knowledge graph in the above method embodiments.

[0071] Refer to Figure 8 , the system includes: a natural language processing module, which is used to use a large language model to perform structured processing on natural language query statements, extract spatial entities, spatial relationships and query intentions therein, and generate corresponding structured data; a knowledge graph construction module, which is used to construct a spatial relationship knowledge graph, and the spatial relationship knowledge graph includes geographical spatial entities, surveying and mapping archive data, and spatial relationships; a query statement generation module, which is used to match the generated structured data with the spatial relationship knowledge graph, obtain a structured query statement template, and generate a final structured query statement; a database query module, which is used to execute the structured query statement in the spatial database and return the query result.

[0072] The address search system for enhancing LLM based on a spatial relationship knowledge graph provided by the embodiment of the present invention aims at problems such as low query efficiency, high query threshold, and insufficient support for queries with complex spatial relationships in traditional geographic information system queries, and adopts Figure 8 several modules therein. By leveraging the capabilities of the large language model and aligning knowledge through the knowledge graph, the geographic information system can better understand natural language, thereby improving the intelligent interaction experience of users when using the geographic information system.

[0073] It should be noted that the system embodiments provided by the present invention are used not only to implement the methods in the above method embodiments, but also to implement the methods in other method embodiments provided by the present invention. The difference lies only in setting corresponding functional modules. The principle is basically the same as that of the above system embodiments provided by the present invention. As long as those skilled in the art, on the basis of the above system embodiments, refer to the specific technical solutions in other method embodiments, obtain corresponding technical means by combining technical features, and the technical solutions composed of these technical means, and ensure the practicability of the technical solutions, then improve the modules in the above system embodiments to obtain corresponding system-like embodiments for implementing the methods in other method-like embodiments. For example: Based on the content of the above system embodiments, as a preferred embodiment, an address search system for enhancing LLM based on a spatial relationship knowledge graph provided in an embodiment of the present invention, the knowledge graph construction module further includes: An ontology library design unit for designing the ontology library of the spatial relationship knowledge graph, including entity concepts and their attributes and relationship types and their attributes; A knowledge extraction unit for extracting spatial entities, surveying and mapping archive data, and knowledge related to spatial relationships from structured and unstructured data; A knowledge fusion unit for achieving entity alignment based on the entity-concept mapping table and storing the knowledge in a graph database to form a spatial relationship knowledge graph.

[0074] Based on the content of the above system embodiments, as a preferred embodiment, an address search system for enhancing LLM based on a spatial relationship knowledge graph provided in an embodiment of the present invention, the natural language processing module includes: A preprocessing unit for preprocessing natural language query statements; A semantic understanding unit for understanding the semantics of query statements based on a large language model and extracting spatial entities, spatial relationships, and query intentions therein; A structured generation unit for organizing the extracted information into a structured data format according to a preset template.

[0075] Based on the content of the above system embodiments, as a preferred embodiment, an address search system for enhancing LLM based on a spatial relationship knowledge graph provided in an embodiment of the present invention, the query statement generation module includes: A matching unit for matching structured data with the knowledge graph to obtain corresponding structured query statement templates and parameter information; A replacement unit for replacing the parameters in the structured query statement template with the values in the structured data to generate a complete query statement.

[0076] Based on the content of the above system embodiments, as a preferred embodiment, an address search system for enhancing LLM based on a spatial relationship knowledge graph provided in the embodiments of the present invention, the database query module is further configured to execute the following instructions: Receive the structured query statement generated by the query statement generation module, perform a query operation in the spatial database, and return the query result to the user. The spatial database is a PostgreSQL database installed with the PostGIS extension and can support the storage and query operations of spatial data.

[0077] Combined with the above embodiments, it can be seen that the method for semantic structuring of spatial entities based on a large language model constructed by the present invention can well support entity queries based on spatial relationships.

[0078] On existing mainstream map application platforms, the search for spatial entities based on natural language has not been implemented yet. Firstly, none of them provide the function of directly inputting a query statement for distance query, file query, and geographical feature retrieval, and do not support queries with relatively complex natural semantics such as nested spatial relationships.

[0079] However, the method for spatial entity search based on LLM and knowledge graph constructed by the present invention can fully consider the relationships between spatial entities and can well support entity queries based on relationships. Therefore, the method and framework constructed by the present invention have certain application prospects in the future.

[0080] It should be noted that in the present invention, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.

Claims

1. An address search method for enhancing LLM based on a spatial relationship knowledge graph, characterized in that, Including: Using a large language model to structurally process natural language query statements, extract spatial entities, spatial relationships, and query intentions therein, and generate corresponding structured data; Constructing a spatial relationship knowledge graph, which includes geospatial entities, surveying and mapping archive data, and spatial relationships; Matching the generated structured data with the spatial relationship knowledge graph, obtaining a structured query statement template, and generating a final structured query statement; Executing the structured query statement in the spatial database and returning the query result.

2. The method for enhancing address search of LLM based on the spatial relationship knowledge graph according to claim 1, wherein The use of a large language model to structurally process natural language query statements includes: Preprocessing the natural language query statement; Based on the semantic understanding ability of the large language model, extracting spatial entities, spatial relationships, and query intentions in the natural language query statement; Organizing the extracted information into a structured data format according to a preset structured template.

3. The method for enhancing address search of LLM based on the spatial relationship knowledge graph according to claim 1, wherein The construction of the spatial relationship knowledge graph includes: Designing an ontology library for the spatial relationship knowledge graph, including entity concepts and their attributes, and relationship types and their attributes; Performing knowledge extraction on the spatial entity and surveying and mapping archive data parts from structured geospatial data and surveying and mapping archive data to obtain geospatial entities, surveying and mapping archive data, and related attribute information; Completing the knowledge extraction of the spatial relationship part from unstructured text data, combined with geospatial information professional knowledge, with the assistance of a large language model; Performing knowledge fusion, achieving entity alignment according to the entity-concept mapping table, and storing the existing knowledge in a graph database to form a spatial relationship knowledge graph.

4. The method for enhancing the address search of the LLM based on the spatial relationship knowledge graph according to claim 1, wherein The matching of the generated structured data with the spatial relationship knowledge graph includes: Identifying and extracting spatial entities and spatial relationships in the structured data; Searching for nodes and paths in the knowledge graph that match the extracted spatial entities and spatial relationships; According to the matching results, obtaining the corresponding structured query statement template and parameter information.

5. The method for enhancing address search of LLM based on the spatial relationship knowledge graph according to claim 1, wherein The generation of the final structured query statement and the execution of the query operation include: Replacing the parameters in the structured query statement template with the corresponding values in the structured data; Generating a complete structured query statement according to the query intention and parameter information; Executing the generated structured query statement in the spatial database, obtaining the query result, and returning it to the user.

6. An address search system that enhances LLM based on a spatial relationship knowledge graph, characterized in that, Including: A natural language processing module for using a large language model to structurally process natural language query statements, extract spatial entities, spatial relationships, and query intentions therein, and generate corresponding structured data; A knowledge graph construction module for constructing a spatial relationship knowledge graph, which includes geospatial entities, surveying and mapping archive data, and spatial relationships; A query statement generation module for matching the generated structured data with the spatial relationship knowledge graph, obtaining a structured query statement template, and generating a final structured query statement; A database query module for executing the structured query statement in the spatial database and returning the query result.

7. The address search system for enhancing LLM based on the spatial relationship knowledge graph according to claim 6, wherein The knowledge graph construction module includes: An ontology library design unit for designing the ontology library of the spatial relationship knowledge graph, including entity concepts and their attributes, and relationship types and their attributes; A knowledge extraction unit for extracting spatial entities, surveying and mapping archive data, and knowledge related to spatial relationships from structured and unstructured data; A knowledge fusion unit for realizing entity alignment based on the entity-concept mapping table and storing the knowledge in a graph database to form a spatial relationship knowledge graph.

8. The address search system for enhancing LLM based on the spatial relationship knowledge graph according to claim 6, wherein The natural language processing module includes: A preprocessing unit for preprocessing natural language query statements; A semantic understanding unit for understanding the semantics of query statements based on a large language model, and extracting spatial entities, spatial relationships, and query intentions therein; A structured generation unit for organizing the extracted information into a structured data format according to a preset template.

9. The address search system for enhancing LLM based on the spatial relationship knowledge graph according to claim 6, wherein The query statement generation module includes: A matching unit for matching structured data with the knowledge graph to obtain corresponding structured query statement templates and parameter information; A replacement unit for replacing the parameters in the structured query statement template with the values in the structured data to generate a complete query statement.

10. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions cause the computer to execute the address search method for enhancing the LLM based on the spatial relationship knowledge graph according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Position enquiring system based on free-running speech and position enquiring system based on key words

    CN101136028A

  • Retrieval method and retrieval system for knowledge graph in design field of water conservancy industry

    CN115982322A

  • Geographic space information query method, system and equipment based on mapping knowledge domain and medium

    CN117633033A

  • Auxiliary retrieval method fusing knowledge graph and large language model

    CN117633252A

  • Dynamic fusion word embedding and graph structure information query method and system based on attention mechanism

    CN119961428A

Cited By

  • Improved LLM and map interaction streaming acceleration method and system

    CN121009175A