
QUEST: A Natural Language Interface to Relational Databases Vadim Sheinin, Elahe Khorashani, Hangu Yeo, Kun Xu, Ngoc Phuoc An Vo, Octavian Popescu IBM Research, Yorktown Heights, US fi[email protected] Abstract Natural language interfaces to databases systems allow the user to use natural language to interrogate a database. Current systems mainly focus on simple queries but neglect nested queries, which are predominant in real cases. We present a NLIDB system, QUEST, which is able to cope with nested logic queries, without imposing any restrictions on the input query. QUEST outperforms a strong baseline system by 11% accuracy. Keywords: natural language interface to relational database, machine learning. 1. Introduction (McCord et al., 2012) and Cognos1, which aims to pro- Natural language interfaces to database systems (NLIDB) vide effective SQL execution performance. In a nutshell, allow the user to use natural language to interrogate a firstly a database connection is created in Cognos. In a database. This is an old desideratum, but there is no easy Watson UIMA pipeline, a NLQ is decomposed into a set way to attain it. To begin with, even for simple queries of sentences that individually can be resolved by Cognos. that can be solved into a single SQL select query, namely The modules involved in processing the query and handling Simple Logic Queries (SLQs), may be challenging to get Cognos are transparent to the user, who interacts only with the SQL query because of different joins needed to be ex- the web interface. The user is unaware of the complex- ecuted. Moreover, the queries that need a succession of ity involved either in the language analysis or in the nested select in SQL, namely Nested Logic Queries (NLQs), are SQL. very difficult to be handled automatically. NLQs usually As shown in Figure 1, our system is based on a rule- display a wide range of linguistic phenomena like ellipsis based kernel whose role is to ensure a correct translation and anaphora, garden path parsing, etc. Due to this, many from simple queries to SQL. Generally, we have two main systems tend to impose strict limitations on the input query steps: (1) rule based semantic parsing (Quest Engine Box); language, in a way that makes the extraction of logical re- and (2) further SQL generation and execution on databases lationships controllable. But this is not actually a very real- (Cognos Engine Box). In the first step, we generated the istic scenario. lexicalized rules that would be used in the semantic pars- There is a large literature on this research field describing ing (offline part). Specifically, we relied on the schema in- systems that are purely rule based, semi-supervised, and dependent rule templates to automatically extract the lex- unsupervised. We point to excellent overviews of such sys- icalized rules from the schema annotation file. In the on- tems in (Copestake and Jones, 1990; Androutsopoulos et line part, we built a semantic parser using several Wat- al., 1995; Li and Jagadish, 2014). son NLP components in a pipeline fashion, namely English The recent developments in deep learning algorithms seem Slot Grammar parser (ESG), Predicate Argument Structure to bring back into the foreground the NLIDB. Working on (PAS), and Subtree Pattern Matching Framework (SPMF). related topics, such as learning inferences over constrained Our semantic parser will produce a list of SQL sub-queries outputs, global inference in natural languages, open do- that are fed to the second step. In the step 2, we employed main relation extraction (Schwartz et al., 2014) , or more the Cognos server to combine these sub-queries into a fi- recently, resolving algebraic problems expressed in natural nal SQL query which is then executed on the DB2 server. language (Koncel-Kedziorski et al., 2015), provide a strong Experimental results suggest that this approach helps to im- ground for approaching the NLIDB by taking advantage prove 11% accuracy over a very strong baseline. of the power of semi-supervised and unsupervised tech- 2. Nested Question Decomposition niques. However, most systems did not deal with nested One of the main challenges in the NLIDB task is to handle logic queries. nested questions which require additional aggregation op- In this paper we present a semi-supervised methodology to erations over the intermediate results. For example, ”which deal with NLQs in the most general setting: (i) we do not company manufactured more products than Samsung” is a presuppose any restriction on the input query, and (ii) we nested question. To answer this question, we need to solve do not presuppose any restriction on the structure of the the following two sub-questions orderly: database. From a practical point of view, we do not rely on large training data, but rather we build on different tech- 1. how many products did Samsung manufacture ? nologies that carry out linguistic processing of a query up 2. which company manufactured products more than to a point where a specialized engine is able to produce <the answer of question #1> ? a series of SQL queries that return the answer in a recur- sive bottom-up process of computation. We developed a 1http://www.ibm.com/analytics/us/en/ system, QUEST, on top of IBM Watson UIMA pipeline technology/cognos-software/ 2963 Which company manufactured more products than Samsung? Question Decomposition Online Result Comparative Operation Question Rewritting Detection Cognos Engine How many products did manufactures manufacture; Cognos Server Comparative Semantic manufactures has name of #Samsung# Argument Recognition Question Sub Tree Pattern (STP) Sub-question Creation DB2 Server Annotation Matching Offline Schema Schema Annotation AnnotationSchema Schema File Lexicalized AnnotationFile + Independent Rules Rule Templates Rules Figure 1: The Quest Architecture. Intuitively, one way to solve the nested questions is to first 3.1. Rule-based Semantic Parsing decompose the question into several sub-questions, which may be then resolved in a specific order. With recent progress in the structured databases, seman- tic parsing against these databases has attracted more and By analyzing real query logs in our system, we observed more research interests. Almost all of the existing seman- that in most cases, nested questions include comparative tic parsers need to be trained either with the direct super- expressions, such as ”more than” and ”higher than”. Be- vision such as logical forms (Kwiatkowski et al., 2011) or ing motivated by this observation, we proposed a decom- with the weak supervision such as question-answer pairs position method based on analyzing the comparative ex- (Berant et al., 2013). However, in real application scenar- pressions and their arguments. Specifically, we first de- ios, collecting sufficient question-answer pairs to train the veloped a syntactic based method to detect these compar- model remains a challenge. To address this, in this paper ative expressions. Then we used a syntactic scope delim- we proposed a rule-based semantic parser which consists iter to determine the arguments of the expressions, such as of the following three components. ”products” and ”Samsung” in Figure 2. Note that, some- times the arguments may not be compatible due to the el- Question Rewriting The input question is first processed lipsis in natural language, also indicating that this question through the entity annotator, which detects entities in the needs the decomposition. For example, ”products” which question and rewrites the question by replacing these enti- is the left argument of the comparative phrase is countable, ties with their semantic types as described in schema anno- while ”Samsung” is not. To resolve this ellipsis, we iden- tation. We explicitly specified the values of these semantic tified the semantic arguments of the comparative phrase, types with additional description sentences. The key moti- which in our case, is ”the products manufactured by Sam- vation behind this is that entities that appear in a database sung”. To represent the decomposition, we created the sub- column can be meaningless or unrecognizable to the parser. questions for these arguments and replaced these arguments Also, replacing these entities with relative less and finite se- with symbols in the original question. mantic types can further ease the pattern matching problem. 3. Quest Engine Question Annotation After detecting entities and rewrit- ing the question, the question is processed through a se- After the nested question decomposition, each decomposed quence of annotators, such as numerical annotator, date question is fed to the Quest engine, which consists of two annotator, comparator annotator and predicate argument main components, rule generation (offline part) and rule- structure (PAS) annotator. Specifically, comparator annota- based semantic parsing (online part). The main idea of the tors detect particular types of values and operators for those Quest engine is to automatically create a set of schema- values that appear in the question. PAS annotator detects dependent rules, such as sub tree patterns, and finding the predicate argument structure of the question. For in- matches among these rules for different parts of the parsed stance, for the question in Figure 1, comparative annotator input question. From those matched rules, we can create a may create an annotation with operator ”more”. Date an- set of SQL sub-queries which will be later combined and notator may create an annotation if there is any temporal executed in the Cognos server. expression in the question. 2964 3.3. SQL Generation and Execution For each question, the generated SQL sub-queries from the Quest engine are sent to the Cognos server, where the final SQL queries are produced and submitted to database. 4. Experiments In this section we introduce the experimental setup, the main results and detailed analysis of our system. We looked separately at SLQs vs. NLQs, as indeed a large gap in per- formance is noticed between these two cases.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages5 Page
-
File Size-