5
Conversation-Based Natural Language Interface to Relational Databases Majdi Owda, Zuhair Bandar, Keeley Crockett The Intelligent Systems Group, Department of Computing and Mathematics, The Manchester Metropolitan University, Chester Street, Manchester, M1 5GD, UK Email: [email protected] Email: [email protected] Email: [email protected] Abstract This paper proposes a new approach for creating conversation-based natural language interfaces to relational databases by combining goal oriented conversational agents and knowledge trees. Goal oriented conversational agents have proven their capability to disambiguate the user’s needs and to converse within a context (i.e. specific domain). Knowledge trees used to overcome the lacking of connectivity between the conversational agent and the relational database, through organizing the domain knowledge in knowledge trees. Knowledge trees also work as a road map for the conversational agent dialogue flow. The proposed framework makes it easier for knowledge engineers to develop a reliable conversation-based NLI-RDB. The developed prototype system shows excellent performance on common queries (i.e. queries extracted from expert by a knowledge engineer). The user will have a friendly interface that can converse with the relational database. 1. Introduction It is becoming increasingly difficult to ignore the problem of the development of reliable Natural Language Interfaces to Databases (NLIDBs). A considerable amount of literature has been published on the area of NLIDBs. Androutsopoulos [21] defined four main approaches to NLIDBs, each approach is supported by a specific architecture. The first approach is based on Pattern-Matching which is one of the first architectural techniques that have been used for the design and development of NLIDBs. An example of such a system is SAVVY [22]. The second approach is based on an Intermediate Language, which is used to represent an intermediate logical query generated from a natural language question. The intermediate logical query is then transformed into SQL. Two systems of this category are MASQUE/SQL [5] and EDETE [3]. The third approach is based on a Syntax-Based Family of Architectures, where the natural language question is syntactically analyzed to create parse tree(s). The resulting parse tree(s) will then be used directly to create database queries. An example of such a system is LUNAR [11]. The fourth approach is based on the Semantic-Grammar Family of Architectures. This approach also involves the construction of a parse tree and mapping of the parse tree to SQL. The difference between this approach and syntax based approach is the use of semantic categories instead of syntactic concepts where non-leaf nodes in the parse tree are semantic categories. The semantic information about the knowledge domain is hard-wired into the semantic grammar. This family includes systems such as: PLANES [7] [20] and LADDER [20]. Currently there is some ongoing work on NLIDBs which does not fall into the categories defined by Androutsopoulos such as Precise [1], Step [6]. A reliable NLIDB system should overcome the problems associated with the above approaches. Firstly any such system should provide adequate coverage of patterns to represent the domain. Secondly, the system should allow for interactivity with the user. The user must be able to understand the system responses in the case of failure of generating SQL query. Thirdly, overcoming the problem of generating mapping rules from syntax based parse tree to SQL. The approach proposed in this paper is based on the pattern-matching architecture but has two additional components: knowledge trees and a goal oriented conversational agent. Knowledge trees are used to structure the domain knowledge to cover common queries in a particular domain. Whereas a goal oriented conversational agent provides the natural language interface and can help to disambiguate the user’s queries, by allowing for dialogue interaction. The use of the knowledge trees helps direct the conversational agent towards the goal (i.e. query generation from natural language) through interaction with the user. The proposed approach reduces the complexity of building systems by using the knowledge trees to structure and maintain domain knowledge, which is more effective to use than using problematic syntax and semantic grammars. 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops 0-7695-3028-1/07 $25.00 © 2007 IEEE DOI 10.1109/WI-IATW.2007.60 363 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops 0-7695-3028-1/07 $25.00 © 2007 IEEE DOI 10.1109/WI-IATW.2007.60 363 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops 0-7695-3028-1/07 $25.00 © 2007 IEEE DOI 10.1109/WI-IATW.2007.60 363 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops 0-7695-3028-1/07 $25.00 © 2007 IEEE DOI 10.1109/WI-IATW.2007.60 363

[IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

  • Upload
    keeley

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Page 1: [IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

Conversation-Based Natural Language Interface to Relational Databases

Majdi Owda, Zuhair Bandar, Keeley Crockett The Intelligent Systems Group, Department of Computing and Mathematics,

The Manchester Metropolitan University, Chester Street, Manchester, M1 5GD, UK Email: [email protected]

Email: [email protected] Email: [email protected]

Abstract This paper proposes a new approach for creating conversation-based natural language interfaces to relational databases by combining goal oriented conversational agents and knowledge trees. Goal oriented conversational agents have proven their capability to disambiguate the user’s needs and to converse within a context (i.e. specific domain). Knowledge trees used to overcome the lacking of connectivity between the conversational agent and the relational database, through organizing the domain knowledge in knowledge trees. Knowledge trees also work as a road map for the conversational agent dialogue flow. The proposed framework makes it easier for knowledge engineers to develop a reliable conversation-based NLI-RDB. The developed prototype system shows excellent performance on common queries (i.e. queries extracted from expert by a knowledge engineer). The user will have a friendly interface that can converse with the relational database. 1. Introduction

It is becoming increasingly difficult to ignore the problem of the development of reliable Natural Language Interfaces to Databases (NLIDBs). A considerable amount of literature has been published on the area of NLIDBs. Androutsopoulos [21] defined four main approaches to NLIDBs, each approach is supported by a specific architecture.

The first approach is based on Pattern-Matching which is one of the first architectural techniques that have been used for the design and development of NLIDBs. An example of such a system is SAVVY [22]. The second approach is based on an Intermediate Language, which is used to represent an intermediate logical query generated from a natural language question. The intermediate logical query is then transformed into SQL. Two systems of this category are MASQUE/SQL [5] and EDETE [3]. The third approach is based on a Syntax-Based Family of Architectures, where the natural language question is syntactically analyzed to create parse tree(s). The

resulting parse tree(s) will then be used directly to create database queries. An example of such a system is LUNAR [11]. The fourth approach is based on the Semantic-Grammar Family of Architectures. This approach also involves the construction of a parse tree and mapping of the parse tree to SQL. The difference between this approach and syntax based approach is the use of semantic categories instead of syntactic concepts where non-leaf nodes in the parse tree are semantic categories. The semantic information about the knowledge domain is hard-wired into the semantic grammar. This family includes systems such as: PLANES [7] [20] and LADDER [20].

Currently there is some ongoing work on NLIDBs which does not fall into the categories defined by Androutsopoulos such as Precise [1], Step [6].

A reliable NLIDB system should overcome the problems associated with the above approaches. Firstly any such system should provide adequate coverage of patterns to represent the domain. Secondly, the system should allow for interactivity with the user. The user must be able to understand the system responses in the case of failure of generating SQL query. Thirdly, overcoming the problem of generating mapping rules from syntax based parse tree to SQL.

The approach proposed in this paper is based on the pattern-matching architecture but has two additional components: knowledge trees and a goal oriented conversational agent. Knowledge trees are used to structure the domain knowledge to cover common queries in a particular domain. Whereas a goal oriented conversational agent provides the natural language interface and can help to disambiguate the user’s queries, by allowing for dialogue interaction. The use of the knowledge trees helps direct the conversational agent towards the goal (i.e. query generation from natural language) through interaction with the user. The proposed approach reduces the complexity of building systems by using the knowledge trees to structure and maintain domain knowledge, which is more effective to use than using problematic syntax and semantic grammars.

2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops

0-7695-3028-1/07 $25.00 © 2007 IEEEDOI 10.1109/WI-IATW.2007.60

363

2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops

0-7695-3028-1/07 $25.00 © 2007 IEEEDOI 10.1109/WI-IATW.2007.60

363

2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops

0-7695-3028-1/07 $25.00 © 2007 IEEEDOI 10.1109/WI-IATW.2007.60

363

2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops

0-7695-3028-1/07 $25.00 © 2007 IEEEDOI 10.1109/WI-IATW.2007.60

363

Page 2: [IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

This paper is organized as follows: Sections 2 and 3 will introduce the main concepts behind conversational agents and knowledge trees. Section 4 will introduce the proposed framework architecture. Section 5 presents a prototype system based on this study. Section 6 and 7 include the discussions and conclusions. 2. Conversational Agents

A conversational agent is human-computer dialogue system that interacts with the user turn by turn using natural language. Efforts initiated by Alan Turing in 1950 by his famous paper Computing Machinery and Intelligence [8]. He suggested that within 50 years a computer would pass a comparison test if it is a human or a machine. In the 1960s work on conversational agents aimed at Turing Test conditions was ELIZA [16] which is a computer program simulates a psychotherapist. ELIZA is based on simple stimulus-response architecture (i.e. patterns and their responses), where ELIZA turns the input patterns into questions as responses. A number of programs have been developed based on lessons learned from ELIZA such as: PARRY [9], ALICE [14], and ADAM [15]. PARRY was built for a specific task that simulates paranoid patients, which makes PARRY hard to be adopted as autonomous component. ALICE and ADAM are general purpose conversational agents. They can be trained and adopted as autonomous components. Allen [17] characterized conversational agents, based on the implementation technique used, into five different groups (ranging from least to most complex): Finite-state script, Frame-based, Set of Contexts, Plan-based models, and Agent-based models.

The conversational agent in our framework should have a set of requirements in order to develop a Conversation-Based NLI-RDB. Firstly it should be an autonomous general purpose conversational agent. Secondly it is capable to deal with a set of contexts, and to direct the users towards a goal, which gives the conversational agent the flexibility and robustness. Thirdly it should be able to converse freely within a specific domain. Finally it should be able to extract, manipulate, and store information from the users.

ALICE and ADAM meet the above requirements. But ADAM is also a goal oriented which is more suitable to develop a reliable Conversation-Based NLI-RDB.

3. Knowledge Trees

Knowledge Trees has been used for Knowledge Representation and maintenance in many systems (e.g. ESTA [18], and HWYCON [2]). The main purpose of using such trees for Knowledge Representation is that its structure is similar to the way in which humans represent knowledge. The domain expert is not required to have

experience in any programming language. The tree structure also provides an easy way to revise and maintain the knowledge base.

A variety of definitions of the term knowledge tree have been suggested. Yager [12] defines the idea of a knowledge tree as a mechanism providing a global framework for the mobilization of a knowledge base in response to a specific query. Our definition of a knowledge tree in the context of this paper is a tree where the knowledge is organized in a hierarchical structure based on the expert knowledge which has been extracted and developed by a knowledge engineer. Hence the knowledge trees serves as a road map for the conversation flow in a specific domain.

4. Conversation-Based Natural Language Interfaces to Relational Databases Framework 4. 1. Overview The proposed architecture shown in Figure 1, involves four main components which are: conversational agent, knowledge tree, conversation manager, and relational database. The conversation manager provides a mechanism for communication between all components. This main component manages the whole system, through messages with the other components. Firstly it communicates with the users by taking the users inputs and sending feedbacks. Secondly it communicates with the knowledge tree for taking directions or solutions. Thirdly it communicates with the conversational agent for passing inputs and getting responses. Fourthly it communicates with the relational database in order to execute the formulated SQL queries. This core component keeps the system manageable, where future problems could be handled easily and providing a flexible way of extending the system. The four components shown in Figure 1 will be described in details in the following sub sections.

4.2. Conversational Agent The conversational agent component used in this framework is adopted from a real time flexible conversational agent called ADAM [15]. ADAM has been used to manage a conversation within a specific context, where each context has its own context file (i.e. topic file). Managing conversations includes pattern matching, chatting about specific contexts, and extracting information.

364364364364

Page 3: [IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

Figure 1. Conversation-Based Natural Language Interface to Relational Databases Framework Architecture. 4.3. Knowledge Tree The knowledge tree introduced in this framework has three different characteristics. Firstly it provides an easy way of creating, structuring, updating, revising, and maintaining knowledge. Secondly it is based on the expert’s knowledge hierarchy in relation to the relational database domain. This can be done through eliciting the expert’s knowledge by knowledge engineers (i.e. extracting common natural language queries from the expert). Thirdly it is a conversational tree, where each node has a script file to be used by the conversational agent. Figures 2 showing the structure of the knowledge tree for the relational database which is explained in details in section 4.5. In figure 2 the following symbols mean:

a start node in the tree, where it can be main tree or sub-tree.

Direction node or multi-value node, where in contains information about the current node and further directions down to the bottom of the tree.

Node link, it is a signpost for a node from the current node.

Report node or SQL statement node or leaf node, this node will carry the target or solution, mainly it carry SQL statements.

Figure 2. Knowledge Tree Sample Expansion. The knowledge tree starts with a main node, and each node in the tree is represented by a separate context which has its own links. Each node can be a direction node or a report node. A direction node is a non-leaf node, which carries direction information and dialogues. A report node is a leaf, which carries the syntax of the SQL queries and further dialogues. The conversational manager uses the knowledge tree as a road map. It also uses the knowledge tree in combination with the conversational agent to converse with the user in order to formulate an SQL query. The conversational manager uses the start node as an initial node and leaf nodes are the target nodes. The knowledge tree coverage is based on the expert knowledge. The expert knowledge elicited by a knowledge engineer, where the elicitation covers common queries. Updating the knowledge tree by increasing and decreasing the coverage is very simple and maintainable.

4.4. Conversation Manager This component is responsible for managing the system through its communication with knowledge tree, conversational agent, and relational database, where it plays many roles: Firstly the conversation manager is responsible for communicating with the user. It will take user inputs in two cases: firstly it takes the user input and pass it to the conversational agent for matching. Secondly it takes the user input in the case where extra information is needed to formulate the response. On the way back (i.e. sending responses to the user) it is either send back responses to directions, or asking extra information to formulate the query, or responses carrying results.

Relational Database

Knowledge Tree

SQL statements

Context Script files

Conversational Agent

Rule Matching

Conversation Manager

Context Switching &

Manage

Agent Response

Response Generation

User Query

Information Extraction

365365365365

Page 4: [IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

Secondly the conversation manager is responsible for the communication with the conversational agent by a set of setting and getting methods, for example (setting new context, setting inputs, setting and getting variables names and values, setting and getting context names, and getting response). Thirdly the conversation manager communicates with the knowledge tree in order to direct the conversation towards the goal (i.e. formulating an SQL statement which maps onto the users requirements). Fourthly the conversation manager is responsible for generating responses whether to carry on conversation or to return results. If a direction node is reached, then the conversation continues until all necessary information is captured. If a leaf node is reached and more information is required e.g. the query is not completed, then the conversation will continue. Results responses are generated when a leaf node in the knowledge tree is reached and no extra information is required to formulate an SQL statement. The result response will return the data returned by the execution of the SQL statement.

4.5. Relational Database The relational database is an independent component since the proposed architecture can work with any relational database management system to obtain a result set for any SQL statement. The relational database schema used in the prototype is for a global computing company. Information currently stored in this relational database is in the areas of: product information, customer’s accounts, customer shipment, market segment (i.e. Consulting, Education, Government, Manufacturing, Reseller), distribution channels (i.e. Direct Sales, Catalog, Internet), regions, products units, unit price and cost, sales, warehouses, and time. 5. The prototype system This section explains the developed prototype for the Global Computing Company Relational Database, where the knowledge for common queries was used to construct a knowledge tree. Script files also created for each node in the tree in order to manage the conversation. The prototype has a flexible mechanism of dealing with both expert users and naive users, where expert users can enter their queries directly in full into the system, and naive users can navigate through the system using options provided. You notice this flexibility in figure 3. It also provides a variety of different types of generated SQL queries from simple single table queries to complex multi-tables queries. The generation of these queries depends on the knowledge engineer who extracts the knowledge from the expert. 6. Discussion

It is difficult to carry out a general comparative evaluation for NLIDBs since each NLIDB developed for different task. Once the system is fully developed then a full evaluation will be taken based on the reliability and user acceptance of the system. This study will adopt scenario-based method for discussing the developed system. Figure 3 shows an example dialogue scenario. CB-NLI-RDB is an abbreviation for conversation-based natural language interface to relational database, and USR is an abbreviation for user.

1 CB-NLI-RDB

Hi I am here to help you explore our company database. What do you want to know? Use the options if that accommodate you! - sales

- profitability - products - customers

2 USR Aha, I want to know about sales. 3 CB-NLI-

RDB What do you want to know about sales? - sales for products - products families - product classes

4 USR I want sales for all products in the current month.

5 CB-NLI-RDB

SQL Generated: SELECT A.ITEM_DSC as "Item description" , sum(C.UNITS) AS "Number of items" FROM PROTOTYPE.PRODUCT_DIM A , PROTOTYPE.UNITS_UPDATE_FACT C WHERE(C.ITEM_ID = A.ITEM_ID) group by A.ITEM_DSC The result set: Item description Number of items 1.44MB External 3.5 Diskette 964 Deluxe Mouse 5797 Envoy Ambassador 179

Figure 3. An Example Dialogue In figure 3 the utterance (1) the prototype system initiated (i.e. started) the conversation. In utterance (2) the user chooses on of the options offered. In utterance (3) the prototype system offers more specific options. In utterance (4) the user enters the full query. In utterance (5) the prototype system sends a final response which includes the SQL syntax and the result set. 7. Conclusions and Future Work The proposed framework introduces an easy and flexible way in order to develop a Conversation-Based NLI-RDB, through the use of goal oriented conversational agent and knowledge trees. A goal oriented

366366366366

Page 5: [IEEE 2007 IEEE/WIC/ACM International Conferences on Web Intelligence and Intelligent Agent Technology - Workshops - Silicon Valley, CA, USA (2007.11.5-2007.11.12)] 2007 IEEE/WIC/ACM

conversational agent provides the natural language interface and helps disambiguate the user’s queries, by utilizing dialogue interaction. Knowledge trees are easy to create, structure, update, revise, and maintain. Further more the knowledge trees will direct the conversational agent towards the goal (i.e. query generation from natural language). This framework is a general purpose which can be applied to a wide range of domains. The developed prototype proved it is capability of handling simple and complex queries. It provides naive users an easy and friendly interface to relational databases. It is also an autonomous package can be attached to any relational database. Our future work is to develop an adaptive conversation-based natural language interfaces to relational databases, by inventing a much more dynamic knowledge trees that could be navigated by a goal oriented conversational agent. Acknowledgment

The author wishes to acknowledge, with thanks, the Convagent Ltd, Manchester, United Kingdom. 8. References [1] A. Popescu , O. Etzioni , and H. Kautz, “Towards a theory of natural language interfaces to databases”, Proceedings of the 8th international conference on Intelligent user interfaces, ACM Press, Miami, Florida, USA, January 12-15, 2003, pp. 327-327. [2] L. Kaetzel, J. Clifton, P. Klieger, and K. Snyder, “Highway concrete (HWYCON) expert system user reference and enhancement guide”, Gaithersburg: National Institute of Standards and Technology (BFRL), 1993. [3] P. Reis, N. Mamede, and J. Matias, “Edite – A Natural Language Interface to Databases: a New Dimension for an Old Approach”, Proceeding of the Fourth International Conference on Information and Communication Technology in Tourism, Edinburgh, Scotland, 1997. [4] A. Blum, “Microsoft english query 7.5: Automatic extraction of semantics from relational databases and OLAP cubes”, Proceedings of the 25th International Conference on Very Large Data Bases, Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, pp. 247–248, 1999. [5] I. Androutsopoulos, G. Ritchie, and P. Thanisch, “MASQUE/SQL – An Efficient and Portable Natural Language Query Interface for Relational Databases”, Proceedings of the 6th international conference on Industrial and engineering applications of artificial intelligence and expert systems, Gordon & Breach Science Publishers, Edinburgh, Scotland, 1993, pp. 327-330. [6] M. Minock, “A phrasal approach to natural language access over relational databases”, proceedings of the 10th International Conference on Applications of Natural Language to Information Systems, Alicante, Spain, 2005, pp. 333-336. [7] G. Hendrix, E. Sacerdoti, D. Sagalowicz, and J. Slocum, “Developing a Natural Language Interface to Complex Data”, ACM Trans. Database Syst., ACM Press, New York, NY, USA, 1978, pp. 105-147.

[8] A. Turing, (1950), “Computing machinery and intelligence”, Computation & intelligence: collected readings, American Association for Artificial Intelligence, Menlo Park, CA, USA, 1995, pp. 23-46 [9] K. Colby, “Simulation of Belief systems”, Computer Models of Thought and Language, pp.251-286, 1973. [10] D. Michie and C. Sammut, Infochat Scriper’s Manual, Technical Repoort, Convagent Ltd, Manchester, UK, 2001. [11] W. Woods, R. Kaplan, and B. Webber, “The Lunar Sciences Natural Language Information System”, Final Report, Technical Report 2378, Bolt Beranek and Newman Inc., 1972. [12] R. Yager, "Knowledge trees and protoforms in question-answering systems: Special Topic Section on Soft Approaches to Information Retrieval and Information Access on the Web", J. Am. Soc. Inf. Sci. Techn..l, New York, NY, USA, 2006,v. 57, pp. 550-563. [13] D. Michie, “Return of the imitation game”, Electronic Transactions in Artificial Intelligence, 2001, v. 5-B2(024), pp. 203-221. [14] R. Wallace, The Anatomy of A.L.I.C.E., Artificial Intelligence Foundation Inc. Avialable at: http://www.alicebot.org/anatomy.html, (2004). [15] Adam: Student Debt Advisor, Convagent Ltd, Manchester, UK, 2001, Available at: http://www.convagent.com/convagent/adam3.aspx [16] J. Weizenbaum, “ELIZA - A Computer Program for the Study of Natural Language Communication between Man and Machine”, Communications of the ACM, ACM Press, New York, NY, USA, 1966, v. 9(1), pp. 36-45. [17] J. Allen, D. Byron, M. Dzikovska, G. Ferguson, L. Galescu, and A. Stent, "Toward conversational human-computer interaction", AI Mag., American Association for Artificial Intelligence, Menlo Park, CA, USA, 2001, v. 22, pp. 27-37. [18] “Introduction to ESTA (Expert System Shell for Text Animation)”, Prolog Development Center, Denmark. http://www.visual-prolog.com/vip6/Community/esta/esta.htm [19] J. Allen, L. Schubert, G. Ferguson, P. Heeman, C. Hwang,T. Kato, M. Light, N. Martin, B. Miller, M. Poesio, and D. Traum, “The TRAINS Project: A Case Study in Defining a Conversational Planning Agent”, University of Rochester, Rochester, NY, USA, 1994. [20] I. Androutsopoulos, G. Ritchie, and P. Thanisch. “Natural language interfaces to databases-an introduction”, Journal of Language Engineering, 1995, v. 1(1), pp. 29-81. [21] T. Johnson, “Natural Language Computing: The Commercial Applications”, Knowledge Engineering Review, 1986, v. 1, pp. 11-23.

367367367367