A semantic analysis query method and system
By using open-source Redis and ElasticSearch in conjunction with a tokenizer to parse user query statements, the problem of numerous and unfriendly parameters in traditional web application queries is solved, achieving a high-efficiency semantic parsing query service and improving query efficiency and quality.
Patent Information
- Application Number
- CN202010608564.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-06-30
AI Technical Summary
Traditional web application query methods require users to accurately input multiple parameters, and are not easily scalable, resulting in high costs and a poor user experience.
The system uses open-source Redis to store configuration tags and Elasticsearch to store geographic location information. It uses an open-source tokenizer to parse user query statements, extract geographic information, obtain mapping information from Elasticsearch, concatenate query conditions, and call the Elasticsearch API to get the results.
It enables the automatic integration of semantic parsing and query services, improving query efficiency and quality and meeting the needs of big data mining.
Smart Images

Figure CN111966783B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of semantic recognition and intelligent query, and in particular to a semantic parsing query method and system. Background Art
[0002] At present, the traditional Web application query implementation method requires that the number of query parameters must correspond to the number of parameter values entered, and they must be accurate. Every time a new or modified parameter is added or modified, the front-end and back-end must add or modify it, which is costly and not conducive to the subsequent expansion of query parameters. At the same time, some parameters have many values, which brings trouble to the user's settings, and the user needs to learn how to set each query parameter, which naturally makes the experience less friendly. Summary of the invention
[0003] Purpose of the invention: The present invention proposes a semantic parsing query method that can effectively obtain relevant information and solve the information query bottleneck problem in data mining. Another purpose of the present invention is to provide a semantic parsing query system based on this method.
[0004] Technical solution: The semantic parsing query method described in the present invention includes the following steps: (1) using open source Redis to store configured tags; (2) using open source ElasticSearch to store POI data and source data about geographic location information; (3) using an open source word segmenter algorithm to analyze the query statement input by the user to extract geographic information and other query information; (4) based on the extracted geographic information, obtaining mapping information from the stored POI data and source data of the geographic location information; (5) splicing the other query information in step (3) and the mapping information in step (4) to form a query condition, and applying the ElasticSearch interface to call the HTTP query to obtain the desired query information.
[0005] In its step (1), it also includes the following steps: In order to obtain the tag library required for system analysis, the implementation scheme is: when the system starts, the tag library information saved in redis is obtained and loaded into the system tag library to facilitate subsequent parsing statements to obtain the included tags and to add / delete tags in real time by subscribing to the redis channel to ensure that the system tags are up to date.
[0006] Furthermore, in step (3), in order to parse the sentence input by the user into keywords recognizable by the system, the query sentence input by the user is parsed by using an open source word segmentation algorithm. After parsing: the query condition information such as geographic location information, distance, time, and tags contained in the sentence is obtained through secondary processing based on the word segmentation result, which is used for the subsequent query of the ElasticSearch interface to splice standard query condition parameters.
[0007] Furthermore, the mapped information in step (4) is real-time POI data, including location ID, name, logo, phone number, longitude and latitude coordinates, address, tags, etc. It is saved in ElasticSearch and used to query the matching longitude and latitude based on the geographic location information parsed from the input statement.
[0008] Furthermore, in step (5), the data queried by the user exists in ElasticSearch, and its external interface needs to be called to obtain the query results. To this end, the results we have parsed need to be spliced with the query statements supported by ElasticSearch, including: splicing json format parameters containing conditions such as latitude and longitude distance, time, and tags.
[0009] Furthermore, step (4) also includes: obtaining the longitude and latitude information matched in the ElasticSearch geographic POI database according to the extracted geographic information, and then obtaining other mapping information according to the longitude and latitude information. The real longitude and latitude information of the location included in the user input sentence is obtained as a query condition to more accurately filter the query results required by the user.
[0010] A system based on the above semantic parsing query method comprises:
[0011] The query module is used to obtain the query statement input by the user; the other query information returned by the parsing module is combined with the mapping information to form the query condition, and the ElasticSearch interface is used to call the http query to obtain the desired query information;
[0012] The parsing module is used to extract geographic information and other query information according to the query statement in the query module, and obtain mapping information from the POI data and source data of the geographic location information stored in the open source ElasticSearch according to the geographic information.
[0013] Beneficial effects: It can realize the automatic connection from semantic analysis to query service, reduce the time and steps of semantic analysis and query service, greatly improve the efficiency and quality of semantic analysis and query service, meet the needs of big data mining, and can be applied in the field of intelligent retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a structural block diagram of the present invention. DETAILED DESCRIPTION
[0015] Figure 1 The external calling system refers to a third-party application that calls the semantic parsing query system interface of the present invention (the method and system of the present invention only provide services for parsing statements and returning matching query results, and the specific query statement input and display of the returned results are handed over to the external calling system).
[0016] The method of the present invention specifically comprises:
[0017] 1. Use the word segmenter to segment the query statement, parse the query statement entered by the user to obtain the geographical location noun, distance, label, time and other information;
[0018] 2. Get the geographic location noun obtained by parsing the query statement, and use it as the query condition to obtain the matching POI data from the ElasticSearch library;
[0019] 3. Assemble poi data and other parsed data into query conditions in json format;
[0020] 4. Call the ElasticSearch query interface to obtain qualified data;
[0021] 5. Parse the results and repackage the return value.
[0022] The query system of the present invention comprises:
[0023] The query module is used to obtain the query statement input by the user; the other query information returned by the parsing module is combined with the mapping information to form the query condition, and the ElasticSearch interface is used to call the http query to obtain the desired query information;
[0024] The parsing module is used to extract geographic information and other query information according to the query statement in the query module, and obtain matching data from the POI (point of interest) data (including location ID, name, logo, telephone number, longitude and latitude coordinates, address, and tag information) of the geographic location information stored in the open source ElasticSearch according to the geographic information, and then form a new query condition based on the longitude and latitude information of the matching POI and other query information parsed at the beginning (including time, tag, distance and other conditions) and then query ElasticSearch to obtain the source data of the matching condition.
[0025] The system operation process is as follows:
[0026] S1: Build ElasticSearch, redis and this system;
[0027] S2: redis stores the tag value;
[0028] S3: ElasticSearch stores geographic POI information and queries raw data;
[0029] S4: simulate the external call system to call the interface service provided by this system, such as the interface testing tool postman tool;
[0030] S5: The parsing module parses the parameter query statement to obtain useful information such as location, distance, time, tags, etc.
[0031] S6: The parsing module calls ElasticSearch to obtain the real geographic location POI latitude and longitude information according to the location;
[0032] S7: The query module encapsulates the query conditions recognized by ElasticSearch in json format according to poi and other parameters, including: longitude and latitude distance, time, and tags;
[0033] S8: The query module calls the ElasticSearch query interface to obtain data that matches the query conditions, and returns the query results to the external calling system.
Claims
1. A semantic parsing query method, It is characterized in that Includes steps: (1) Use open source redis to store configured tags; (2) Use open source ElasticSearch to store POI data and source data about geographic location information; (3) Use an open source word segmentation algorithm to analyze the query statements entered by the user and extract geographic information and other query information; (4) obtaining mapping information from the POI data and source data of the stored geographic location information according to the extracted geographic information; (5) The other query information in step (3) and the mapping information in step (4) are combined to form the query conditions, and the ElasticSearch interface is used to call the http query to obtain the desired query information.
2. The semantic parsing query method according to claim 1, It is characterized in that The step (1) includes: starting the system, obtaining tag library information saved in redis, and adding / deleting tags in real time by subscribing to a redis channel.
3. The semantic parsing query method according to claim 1, It is characterized in that The step (3) includes: using an open source word segmentation algorithm to parse the query statement input by the user, and performing secondary processing based on the word segmentation result to obtain the query condition information contained in the statement, wherein the query condition information includes geographic location information, distance, time, and tags.
4. The semantic parsing query method according to claim 1, It is characterized in that In step (4), the mapping information is real-time POI data, including location ID, name, logo, phone number, latitude and longitude coordinates, address, and tags.
5. The semantic parsing query method according to claim 1, It is characterized in that The step (4) includes: obtaining the longitude and latitude information matched in the ElasticSearch geographic POI database according to the extracted geographic information, and then obtaining other mapping information based on the longitude and latitude information.
6. The semantic parsing query method according to claim 1, Features: In step (5), the query condition is formed by concatenating the json format parameters containing the condition, and the condition includes: longitude and latitude distance, time, and tag.
7. A system for implementing the semantic parsing query method according to any one of claims 1 to 6, It is characterized in that The system includes: The query module is used to obtain the query statement input by the user; the other query information returned by the parsing module is combined with the mapping information to form the query condition, and the ElasticSearch interface is used to call the http query to obtain the desired query information; The parsing module is used to extract geographic information and other query information according to the query statement in the query module, and obtain mapping information from the geographic location information poi data and source data stored in the open source ElasticSearch according to the geographic information.
Citation Information
Patent Citations
Semantic comprehension-based interest point query method and device and computer equipment
CN108763293A
A Chinese geographic information query method and system
CN109344341A
Geographic information retrieval method and device, electronic equipment and readable storage medium
CN110674419A
Chinese natural language query system and method
US20020052871A1
Location Based Full Text Search
US20130132398A1
