Natural language place name query method and device and electronic equipment
Through the improved DeBERTa model and knowledge graph method, natural language space-time questions are analyzed and the place name semantic context knowledge base is constructed, which solves the accuracy and efficiency of place name query in the existing technology, and realizes efficient space-time semantic place name consultation services.
Patent Information
- Application Number
- CN202510489203.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-04-18
AI Technical Summary
The prior art is difficult to accurately identify and query place name information in natural language, and cannot meet users' needs for space-time semantic place name consultation, resulting in a decrease in user experience.
The improved DeBERTa model is adopted, combining BiGRU layer and CRF layer to analyze natural language space-time questions, extract text semantic information and place name context information, and construct a place name semantic context knowledge base through knowledge graph method to conduct place name query.
It realizes accurate analysis of natural language space-time questions and place name query, improves query execution efficiency and user experience, and meets users' needs for space-time semantic place name consultation.
Smart Images

Figure CN120011525A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of natural language query technology, and in particular, to a natural language place name query method, device and electronic device. Background Art
[0002] With the explosive growth of information resources, the huge amount of information and complex data organization structure have brought great challenges to the retrieval of place name information. Geographic and temporal information is usually provided in the form of unstructured text, which makes the information retrieval task more complicated and indirect. Therefore, a place name query method is needed to meet user needs, analyze the natural question language provided by users, and extract the geographical related information implicit in the semantics. However, the existing query methods can only focus on the query at the semantic level of place names at most, and cannot focus on the user query IP context in the natural question language, so they cannot accurately meet the actual natural language place name query needs, resulting in the inability to accurately provide place name consultation services rich in spatiotemporal semantics, which reduces user satisfaction. Summary of the invention
[0003] The embodiments of this specification provide a natural language place name query method, device and electronic device, and the technical solution thereof is as follows: In a first aspect, an embodiment of the present specification provides a natural language place name query method, the method comprising: Parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; Constructing a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The space-time question information is queried based on the place-name semantic context knowledge base to obtain a place-name query result corresponding to the target natural language space-time question.
[0004] In a second aspect, a natural language place name query device is provided, the device comprising: A parsing module, for parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on a trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; A construction module, used to construct a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The query module is used to query the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question.
[0005] In a third aspect, an electronic device is provided, including a device processor and a memory; The device processor is connected to the memory; The memory is used to store executable program code; The device processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method provided in the first aspect or any possible implementation manner of the first aspect.
[0006] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and the computer-readable storage medium stores instructions, which, when the instructions are executed on a computer or a device processor, cause the computer or the device processor to execute the method provided in the first aspect or any possible implementation of the first aspect.
[0007] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least: In one or more embodiments of the present specification, the spatiotemporal question information corresponding to the target natural language spatiotemporal question is first parsed based on the trained deep learning model, and then the place name semantic context knowledge base corresponding to the preset location information is constructed according to the knowledge graph method, and then the spatiotemporal question information is further queried according to the place name semantic context knowledge base, and finally the place name query result corresponding to the target natural language spatiotemporal question is obtained. The place name feature words are extracted from the parsed text semantic information, and then the extracted place name data context and the place name context information corresponding to the user query IP address are merged into place name context information, and the text semantic information and the place name context information are further integrated into spatiotemporal question information, and a place name semantic context knowledge base covering the potential context information of the place name and rich place name semantic relations is constructed for querying the spatiotemporal question information, so that the server can more accurately identify the potential place name semantic context behind the target natural language spatiotemporal question, ensure that the place name query optimization result is more in line with user needs, and significantly improve the query execution efficiency and user experience while meeting the semantic needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0009] Figure 1 A flowchart of a natural language place name query method provided in an embodiment of this specification; Figure 2 A schematic diagram of the construction process of a place name semantic context knowledge base provided in an embodiment of this specification; Figure 3 A schematic diagram of the structure of a natural language place name query device provided in an embodiment of this specification; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0010] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0011] The terms "first", "second", "third", etc. in the description and claims of this specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0012] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present specification. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described with respect to some examples may be combined in other examples.
[0013] See also Figure 1 , Figure 1 The overall flow chart of a natural language place name query method provided by an embodiment of this specification is shown.
[0014] like Figure 1 As shown, the natural language place name query method may at least include the following steps: Step 101: parse the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model.
[0015] Among them, the trained deep learning model is an improved DeBERTa model, which is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model. The target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information.
[0016] In an embodiment of the present specification, after receiving a query instruction sent by a target user terminal, the server can obtain the target natural language spatiotemporal question through the query instruction. In general, the target natural language spatiotemporal question contains important information closely related to the place name, place name attributes, spatiotemporal relationships, numbers and units, etc. Therefore, in order to understand the query intention of the target user and enable the computer to directly understand and process the query request, the target natural language spatiotemporal question can be parsed through a trained deep learning model to obtain text semantic information and place name context information, and express it as spatiotemporal question information. Through the above process, the target natural language spatiotemporal question in an unstructured format can be parsed and converted into structured data that can be used for direct computer recognition and processing, so as to facilitate subsequent further place name queries.
[0017] Among them, the trained deep learning model adopts the improved DeBERTa model, that is, the BiGRU network layer is connected after the DeBERTa model to obtain more contextual semantic features, and then the CRF layer is introduced after the BiGRU network to obtain the label sequence, so as to better understand the semantic relationship between different words in the sentence, capture long-distance dependencies and resolve ambiguity.
[0018] In one possible implementation, parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model includes: Parse the text semantic information corresponding to the target natural language spatiotemporal question based on the trained deep learning model; Determine the place name data context corresponding to the text semantic information and the user query context corresponding to the query address information respectively, and obtain place name context information composed of the place name data context and the user query context, wherein the place name data context is used to represent the place name information contained in the text semantic information; The text semantic information and the place name context information are integrated to obtain spatiotemporal question information.
[0019] In an embodiment of the present specification, when parsing the spatiotemporal question information corresponding to a target natural language spatiotemporal question through a trained deep learning model, the target natural language spatiotemporal question can be first taken as input and transmitted to the trained deep learning model, and the text semantic information corresponding to the target natural language spatiotemporal question can be obtained through its model output.
[0020] As an example, the target natural language spatiotemporal question is "What cities are within a radius of 500 kilometers around Beijing?", and the text semantic information output by the model is "Location: Beijing, Distance: 500 kilometers, Event: City".
[0021] Next, because place names themselves have obvious contextual relevance, the geographic spatiotemporal semantics expressed by the same place name in different contexts are different. Therefore, the place name data context corresponding to the text semantic information can be determined by extracting geographic key feature words. As an example, the text semantic information output by the model is "Location: Beijing, Distance: 500 kilometers, Event: City". The place name data context corresponding to the geographic key feature words is obtained by extracting geographic key feature words: "Beijing". Then, the corresponding user query context is determined by querying the IP address information, and the place name context information composed of the two is further obtained. Finally, the obtained text semantic information and place name context information are integrated to obtain spatiotemporal question information.
[0022] In one possible implementation, parsing text semantic information corresponding to a target natural language spatiotemporal question based on a trained deep learning model includes: Constructing an initial DeBERTa-BiGRU-CRF model, and training the DeBERTa-BiGRU-CRF model based on a training label data set to obtain a trained DeBERTa-BiGRU-CRF model; The text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained DeBERTa-BiGRU-CRF model.
[0023] In the embodiment of this specification, in order to parse the text semantic information corresponding to the target natural language spatiotemporal question, an initial DeBERTa-BiGRU-CRF model can be constructed first. Specifically, the DeBERTa model is first connected after the data embedding layer, and then the BiGRU network layer is connected after the DeBERTa model, and further the CRF layer is introduced after the BiGRU network.
[0024] The embedding layer converts discrete text data into continuous, low-dimensional vector representation. Input text , the embedding layer will generate Learn a corresponding embedding vector, corresponding to the output vector ,in Is the corresponding word These embedding vectors are used as input to subsequent layers.
[0025] The DeBERTa model is an improvement on the BERT model. It uses word embedding training to obtain the deep semantic features of natural semantic place name spatiotemporal questions and convert text into word vectors. The calculation formula of the decoupled attention input representation of the DeBERTa model is as follows: in, , represents the content embedding of the i-th and j-th words, represents the relative position embedding of word i and word j, represents content-to-content computation, and Represents the calculation from content to location and location to content, Represents a position-to-position calculation.
[0026] The BiGRU layer is built on the basis of two GRUs, both of which are unidirectional but in opposite directions. In the unidirectional GRU network structure, state information is transmitted in one direction, such as the GRU from left to right, which can only learn the information of the previous moment. However, the output of the BiGRU network layer is jointly determined by the two GRUs, and can learn the information of the previous moment and the next moment. Since the semantic information of a sentence is related to both the previous and the following context, the BiGRU network layer is used to further obtain comprehensive context information.
[0027] Furthermore, the CRF layer introduced after the BiGRU network layer is to effectively model the label dependency and ensure that the generated label sequence is coherent and reasonable. The goal of this layer is to identify geographic entities in natural language questions and annotate the extracted word vectors in BIOES format, where B represents the first word in the annotation sequence, I represents the remaining words in the middle, E represents the last word, S represents a single word, and O represents irrelevant information.
[0028] As an example, the target natural language spatiotemporal question is "What cities are within a radius of 500 kilometers around Beijing?" The text semantic information output by the model is "Location: Beijing, Distance: 500 kilometers, Event: City". The geographic entities and relationships in the vector are extracted and labeled through the BiGRU network layer. Beijing, city, surrounding, 500 kilometers, and radius are extracted and labeled, where city and Beijing are the first words of the geographic entities, and surrounding, radius, and 500 kilometers represent the relationship between distance and buffer zone.
[0029] Next, the initial DeBERTa-BiGRU-CRF model is constructed and then trained based on the training label data set to obtain a trained DeBERTa-BiGRU-CRF model. The training label data set includes labeled training natural language spatiotemporal questions. Finally, the labeled natural language spatiotemporal questions are input into the trained DeBERTa-BiGRU-CRF model to obtain the corresponding text semantic information.
[0030] In one possible implementation, the DeBERTa-BiGRU-CRF model is trained based on a training label data set to obtain a trained DeBERTa-BiGRU-CRF model, including: Based on the DeBERTa model, the deep semantic features corresponding to each training natural language spatiotemporal question are obtained to obtain the training word vector; Determine the training label sequence corresponding to each of the training word vectors based on the BiGRU network and the CRF layer; The DeBERTa-BiGRU-CRF model is trained based on the training label data set composed of each of the training label sequences to obtain a trained DeBERTa-BiGRU-CRF model.
[0031] In the embodiments of the present specification, when the DeBERTa-BiGRU-CRF model is trained by a training label data set, a plurality of training natural language spatiotemporal questions can be obtained in advance, and then the deep semantic features corresponding to each training natural language spatiotemporal question can be obtained according to the DeBERTa model to obtain each training word vector. Then, each training word vector is passed through the BiGRU network and the CRF layer in turn to determine the training label sequence corresponding to each training word vector, and further, each training label sequence is paired with each training natural language spatiotemporal question to obtain a training label data set. Finally, the obtained training label data set is compared with the label data set that has been manually calibrated in advance, and the DeBERTa-BiGRU-CRF model is continuously trained according to the comparison results, and the parameters of each model are adjusted to obtain a trained DeBERTa-BiGRU-CRF model.
[0032] In one possible implementation, before parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, the method further includes: Analyze the target natural language spatiotemporal question sentence based on natural language processing technology to obtain target keywords; Based on the semantic matching method, the target keyword is searched in a preset place name database to obtain the query place name category and the query place name context; Expanding the target natural language spatiotemporal question sentence according to the query place name category and the query place name context to obtain a target expanded query sentence; The spatiotemporal question information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model: The spatiotemporal question information corresponding to the target extended query sentence is parsed based on the trained deep learning model.
[0033] In the embodiments of this specification, in order to make up for the lack of information and semantic ambiguity of the target natural language spatiotemporal question in the user query. For example, when the user enters "attractions near Beijing", the system needs to parse "near Beijing" into a specific spatial range by expansion, map "attractions" to relevant categories and database layers (such as "tourist attractions"), and in order to help the server understand synonyms, near synonyms and semantic associations, so as to cope with diverse user expressions, the target natural language spatiotemporal question can be queried and expanded before the deep learning model is parsed. Among them, the target natural language spatiotemporal question can be parsed based on natural language processing technology to obtain preliminary semantic representation target keywords. As an example, for "which hospitals are there in Beijing", the parsed target keywords include "location: Beijing", "question words: which" and "location type: hospital". Then, the parsed target keywords are queried in the preset place name database according to the semantic matching method to obtain the query place name category, that is, for the fuzzy description that may appear in the query (such as "near"), the scale information and rules in the preset place name database are combined to supplement the context. For example, "nearby" can be expanded to a specific spatial radius range according to the scale or category of the place name, and the place name disambiguation can be performed based on the user's IP address, geographic coordinates and other information, combined with the place name category and query intent, so as to obtain the query place name context. Further, the target natural language spatiotemporal question is expanded according to the obtained query place name category and query place name context to generate a more complete query expression, that is, the target extended query question. As an example, for "What are the hotels near XX Square", the place name "XX Square" is extracted and mapped to the type, "hotel" is expanded to "hotel, guesthouse, guesthouse", and "nearby" is quantified as a specific spatial range. When the spatiotemporal question information corresponding to the target natural language spatiotemporal question is subsequently parsed, the target extended query question is directly parsed to obtain the spatiotemporal question information, thereby improving the query speed, expanding the query scope, and returning more accurate query results.
[0034] Step 102: construct a place name semantic context knowledge base corresponding to the preset location information based on the knowledge graph method.
[0035] The preset location information includes location common name information, location type information and location scale information.
[0036] In the embodiments of this specification, since in most cases, place names themselves have obvious contextual relevance, the geographic spatiotemporal semantics expressed by the same place name in different contexts are different. In a specific context, a place name can more accurately refer to a geographic space entity and its location. Therefore, in order to consider the background information and user intent of the target natural language spatiotemporal question and improve the accuracy and efficiency of the query, the knowledge graph method can be used to construct a place name semantic context knowledge base covering the potential context information of the place name and enriching the semantic relationship of the place name based on the information of each preset location.
[0037] Specifically, the preset location information includes location common name information, location type information, and location scale information. Among them, the location common name information includes the common name of the location, which is usually a general description of the location and does not include a specific proper name. This type of information is usually used to refer to a certain type of location rather than a specific location. For example, "city", "village", "mountain", "river", etc.
[0038] Among them, the place type information included refers to the classification information of the place, which is classified according to the function, purpose, nature or other standards of the place. It is usually used to describe the specific attributes of the place and classify the place according to certain standards, such as business, education, transportation, etc. The place type information describes the specific type or nature of the place and can be used to provide more details about the place. For example, "shopping center" represents a commercial area mainly for shopping, and "university" represents an institution that provides higher education and research.
[0039] Among them, the place scale information included refers to the size, scope or level of the place, which is usually used to describe the spatial scale or administrative level of the place. For example, it describes the spatial range occupied by the place, such as "large", "medium", "small", and describes the level of the place in the administrative system, such as "national", "provincial", "municipal", "county". The place scale information can reflect the hierarchical relationship and inclusion relationship between places.
[0040] Therefore, in the constructed place name semantic context knowledge base, each spatiotemporal question information corresponds one-to-one to a set of place name query results.
[0041] In one possible implementation, the construction of a place name semantic context knowledge base corresponding to the preset location information according to the knowledge graph method includes: Determine the place name context semantic ontology and place name context semantic attributes based on the preset place information; A place name semantic context knowledge base corresponding to the place name context semantic ontology and the place name context semantic attributes is constructed according to the knowledge graph method.
[0042] In the embodiments of the present specification, when constructing a place name semantic context knowledge base according to the knowledge graph method, the place name context semantic ontology can be first determined according to the preset location information. Among them, the place name context semantic ontology is the basic concept unit in the knowledge graph, which can represent a specific entity or concept. Then, the place name context semantic attributes are determined according to the preset location information. Among them, the place name context semantic attributes describe the characteristics or attributes of the ontology, and associate attributes such as the common name information of the place, the type information of the place, and the scale information of the place with the corresponding ontology.
[0043] Further, such as Figure 2The construction process shown can construct a place name semantic context knowledge base based on the knowledge graph method in a top-down and bottom-up manner. The construction process includes knowledge representation (data acquisition, entity extraction), ontology construction (relationship extraction, attribute extraction), knowledge graph fusion and knowledge storage.
[0044] Step 103: query the spatiotemporal question information based on the place name semantic context knowledge base to obtain a place name query result corresponding to the target natural language spatiotemporal question.
[0045] In the embodiments of the present specification, since each spatiotemporal question information in the constructed place name semantic context knowledge base corresponds one-to-one to a set of place name query results, the parsed spatiotemporal question information can be directly input into the place name semantic context knowledge base to obtain the place name query results corresponding to the target natural language spatiotemporal question.
[0046] In one possible implementation, after querying the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question, the method further includes: Determine the target address corresponding to each target place name in the place name query result; The place name query results are reordered based on the distances between each of the target addresses and the query address to obtain a place name query optimization result.
[0047] In the embodiments of the present specification, after obtaining the place name query result corresponding to the target natural language spatiotemporal question through the place name semantic context knowledge base, since the place name query result may include multiple target place names, the target address corresponding to each target place name in the place name query result can be determined first. Then, the distance between each target address and the query IP address is determined. Furthermore, the sorting priority of each target place name in the place name query result is adjusted from near to far according to the distance, and then the place name query result is re-sorted to obtain the place name query optimization result, so as to ensure that the place name query optimization result is more in line with user needs, and significantly improves the query execution efficiency and user experience while meeting the semantic needs.
[0048] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0049] See next Figure 3 , Figure 3The following is a schematic diagram showing the structure of a natural language place name query device provided in an embodiment of this specification. It should be noted that: Figure 3 The natural language place name query device shown is used to execute the present application Figure 1 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 1 The embodiment shown.
[0050] like Figure 3 As shown, the natural language place name query device may at least include: A parsing module 301 is used to parse the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on a trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; A construction module 302 is used to construct a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The query module 303 is used to query the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question.
[0051] In one possible implementation, the parsing module 301 is specifically used for: Parse the text semantic information corresponding to the target natural language spatiotemporal question based on the trained deep learning model; Determine the place name data context corresponding to the text semantic information and the user query context corresponding to the query address information respectively, and obtain place name context information composed of the place name data context and the user query context, wherein the place name data context is used to represent the place name information contained in the text semantic information; The text semantic information and the place name context information are integrated to obtain spatiotemporal question information.
[0052] In one possible implementation, the parsing module 301 is further configured to: Constructing an initial DeBERTa-BiGRU-CRF model, and training the DeBERTa-BiGRU-CRF model based on a training label data set to obtain a trained DeBERTa-BiGRU-CRF model; The text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained DeBERTa-BiGRU-CRF model.
[0053] In one possible implementation, the parsing module 301 is further configured to: Based on the DeBERTa model, the deep semantic features corresponding to each training natural language spatiotemporal question are obtained to obtain the training word vector; Determine the training label sequence corresponding to each of the training word vectors based on the BiGRU network and the CRF layer; The DeBERTa-BiGRU-CRF model is trained based on the training label data set composed of each of the training label sequences to obtain a trained DeBERTa-BiGRU-CRF model.
[0054] In one possible implementation, the parsing module 301 is further configured to: Analyze the target natural language spatiotemporal question sentence based on natural language processing technology to obtain target keywords; Based on the semantic matching method, the target keyword is searched in a preset place name database to obtain the query place name category and the query place name context; Expanding the target natural language spatiotemporal question sentence according to the query place name category and the query place name context to obtain a target expanded query sentence; The spatiotemporal question information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model: The spatiotemporal question information corresponding to the target extended query sentence is parsed based on the trained deep learning model.
[0055] In one possible implementation, the construction module 302 is specifically used to: Determine the place name context semantic ontology and place name context semantic attributes based on the preset place information; A place name semantic context knowledge base corresponding to the place name context semantic ontology and the place name context semantic attributes is constructed according to the knowledge graph method.
[0056] In one possible implementation, the query module 303 is specifically used to: Determine the target address corresponding to each target place name in the place name query result; The place name query results are reordered based on the distances between each of the target addresses and the query address to obtain a place name query optimization result.
[0057] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (Field-Programmable Gate Array, FPGA), an integrated circuit (Integrated Circuit, IC), etc.
[0058] Each processing unit and / or module of the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.
[0059] See next Figure 3 , Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.
[0060] See next Figure 4 , Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.
[0061] like Figure 4 As shown, the electronic device 400 may include: at least one device processor 401 , at least one network interface 404 , a user interface 403 , a memory 405 , and at least one communication bus 402 .
[0062] The communication bus 402 may be used to realize the connection and communication among the above-mentioned components.
[0063] The user interface 403 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0064] The network interface 404 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0065] Among them, the device processor 401 may include one or more processing cores. The device processor 401 uses various interfaces and lines to connect various parts within the entire electronic device 400, and executes various functions and processes data of the electronic device 400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the device processor 401 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The device processor 401 can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to handle wireless communications. It can be understood that the above-mentioned modem may not be integrated into the device processor 401, and it can be implemented separately through a chip.
[0066] The memory 405 may include a RAM or a ROM. Optionally, the memory 405 includes a non-transitory computer-readable medium. The memory 405 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 405 may optionally be at least one storage device located away from the aforementioned device processor 401. As Figure 4 As shown, the memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0067] Specifically, the device processor 401 may be used to call the natural language place name query application stored in the memory 405, and specifically perform the following operations: Parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; Constructing a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The space-time question information is queried based on the place-name semantic context knowledge base to obtain a place-name query result corresponding to the target natural language space-time question.
[0068] As an option of the embodiment of this specification, the parsing of the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model includes: Parse the text semantic information corresponding to the target natural language spatiotemporal question based on the trained deep learning model; Determine the place name data context corresponding to the text semantic information and the user query context corresponding to the query address information respectively, and obtain place name context information composed of the place name data context and the user query context, wherein the place name data context is used to represent the place name information contained in the text semantic information; The text semantic information and the place name context information are integrated to obtain spatiotemporal question information.
[0069] As an option of the embodiment of this specification, the text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model, including: Constructing an initial DeBERTa-BiGRU-CRF model, and training the DeBERTa-BiGRU-CRF model based on a training label data set to obtain a trained DeBERTa-BiGRU-CRF model; The text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained DeBERTa-BiGRU-CRF model.
[0070] As an optional embodiment of this specification, the DeBERTa-BiGRU-CRF model is trained based on the training label data set to obtain a trained DeBERTa-BiGRU-CRF model, including: Based on the DeBERTa model, the deep semantic features corresponding to each training natural language spatiotemporal question are obtained to obtain the training word vector; Determine the training label sequence corresponding to each of the training word vectors based on the BiGRU network and the CRF layer; The DeBERTa-BiGRU-CRF model is trained based on the training label data set composed of each of the training label sequences to obtain a trained DeBERTa-BiGRU-CRF model.
[0071] As an option of the embodiment of this specification, the construction of a place name semantic context knowledge base corresponding to the preset place information according to the knowledge graph method includes: Determine the place name context semantic ontology and place name context semantic attributes based on the preset place information; A place name semantic context knowledge base corresponding to the place name context semantic ontology and the place name context semantic attributes is constructed according to the knowledge graph method.
[0072] As an option of the embodiment of this specification, before parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, the method further includes: Analyze the target natural language spatiotemporal question sentence based on natural language processing technology to obtain target keywords; Based on the semantic matching method, the target keyword is searched in a preset place name database to obtain the query place name category and the query place name context; Expanding the target natural language spatiotemporal question sentence according to the query place name category and the query place name context to obtain a target expanded query sentence; The spatiotemporal question information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model: The spatiotemporal question information corresponding to the target extended query sentence is parsed based on the trained deep learning model.
[0073] As an optional embodiment of this specification, after querying the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question, the method further includes: Determine the target address corresponding to each target place name in the place name query result; The place name query results are reordered based on the distances between each of the target addresses and the query address to obtain a place name query optimization result.
[0074] The embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0075] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0076] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0077] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0078] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0079] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0080] If the integrated unit 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 memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0081] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0082] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A natural language place name query method, characterized in that: The method comprises: Parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; Constructing a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The space-time question information is queried based on the place-name semantic context knowledge base to obtain a place-name query result corresponding to the target natural language space-time question.
2. The method according to claim 1, characterized in that The step of parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model includes: Parse the text semantic information corresponding to the target natural language spatiotemporal question based on the trained deep learning model; Determine the place name data context corresponding to the text semantic information and the user query context corresponding to the query address information respectively, and obtain place name context information composed of the place name data context and the user query context, wherein the place name data context is used to represent the place name information contained in the text semantic information; The text semantic information and the place name context information are integrated to obtain spatiotemporal question information.
3. The method according to claim 2, characterized in that The text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model, including: Constructing an initial DeBERTa-BiGRU-CRF model, and training the DeBERTa-BiGRU-CRF model based on a training label data set to obtain a trained DeBERTa-BiGRU-CRF model; The text semantic information corresponding to the target natural language spatiotemporal question is parsed based on the trained DeBERTa-BiGRU-CRF model.
4. The method according to claim 3, characterized in that The DeBERTa-BiGRU-CRF model is trained based on the training label data set to obtain a trained DeBERTa-BiGRU-CRF model, including: Based on the DeBERTa model, the deep semantic features corresponding to each training natural language spatiotemporal question are obtained to obtain the training word vector; Determine the training label sequence corresponding to each of the training word vectors based on the BiGRU network and the CRF layer; The DeBERTa-BiGRU-CRF model is trained based on the training label data set composed of each of the training label sequences to obtain a trained DeBERTa-BiGRU-CRF model.
5. The method according to claim 1, characterized in that The method of constructing a place name semantic context knowledge base corresponding to the preset place information according to the knowledge graph method includes: Determine the place name context semantic ontology and place name context semantic attributes based on the preset place information; A place name semantic context knowledge base corresponding to the place name context semantic ontology and the place name context semantic attributes is constructed according to the knowledge graph method.
6. The method according to claim 1, characterized in that Before parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on the trained deep learning model, the method further includes: Analyze the target natural language spatiotemporal question sentence based on natural language processing technology to obtain target keywords; Based on the semantic matching method, the target keyword is searched in a preset place name database to obtain the query place name category and the query place name context; Expanding the target natural language spatiotemporal question sentence according to the query place name category and the query place name context to obtain a target expanded query sentence; The spatiotemporal question information corresponding to the target natural language spatiotemporal question is parsed based on the trained deep learning model: The spatiotemporal question information corresponding to the target extended query sentence is parsed based on the trained deep learning model.
7. The method according to claim 1, characterized in that After querying the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question, the method further includes: Determine the target address corresponding to each target place name in the place name query result; The place name query results are reordered based on the distances between each of the target addresses and the query address to obtain a place name query optimization result.
8. A natural language place name query device, characterized in that: The device comprises: A parsing module, for parsing the spatiotemporal question information corresponding to the target natural language spatiotemporal question based on a trained deep learning model, wherein the trained deep learning model is an improved DeBERTa model, and the improved DeBERTa model is obtained by adding a BiGRU layer and a CRF layer after the DeBERTa model, and the target natural language spatiotemporal question is obtained by obtaining a query instruction, and the spatiotemporal question information includes text semantic information and place name context information; A construction module, used to construct a place name semantic context knowledge base corresponding to preset place information according to the knowledge graph method, wherein the preset place information includes place common name information, place type information and place scale information, and the place scale information includes spatial scale information and administrative level information of the place; The query module is used to query the spatiotemporal question information based on the place name semantic context knowledge base to obtain the place name query result corresponding to the target natural language spatiotemporal question.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer-readable storage medium has instructions stored therein, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Chinese named entity recognition method based on BERT-BiGRU-CRF
CN110083831A
Intelligent dialogue method and device based on financial knowledge graph, and electronic equipment
CN113988071A
Address entity identification method based on multilayer knowledge perception
CN117010398A
Space-time question semantic understanding method and device, equipment and medium
CN118734861A
Data query method, device, equipment and product
CN119166654A
Cited By
GIS buffer generation method and system based on fuzzy semantics and geographic constraints
CN120726256A
Method and system for generating GIS buffer based on fuzzy semantics and geographic constraints
CN120726256B
Context-considered spatial relationship natural language statement conversion method and device
CN120951951A
A method and apparatus for natural language sentence conversion that takes into account spatial relationships in context
CN120951951B