Vous êtes sur la page 1sur 14

Natural Language Applications

Natural Language
Applications
Natural Language Applications
A Database Front End
The task of a data base front end is to
translate a question in natural
language well-formed query in the
data base language. For example,
using the SQL data base language
(Ullman 1982), the natural language
front end would translate the question
Who hired John Smith? into the
query.
Natural Language Applications


SELECT MANAGER
FROM MANAGER_OF_HIRE
WHERE EMPLOYEE = John Smith
Natural Language Applications
In performing this translation, the
program must also decide where to look in the
data base (the MANAGER_OF_HIRE
relation), the name of the field to access
(MANAGER), and the constraints on the query
(EMPLOYEE =John Smith).
None of this information was in the
original question: it was found in a knowledge
base that knew about the organization of the
data base and the meaning of potential
answers.

Natural Language Applications
Relational Data Base
organizes data in relations across
domains of entities.

Employee Manager
John Smith Jane Martinez
Alex Barrero Ed Angel

Don Morrison Jane Martinez

Jan Claus Ed Angel
Anne Cable Bob Veroff
Manager_of_hire Employee_salary
Employee Salary
John Smith $35,000.00
Alex Barrero $42,000.00

Don Morrison $50,000.00

Jan Claus $40,000.00
Anne Cable $45,000.00
Natural Language Applications
Domains / Entities
set of managers
set of employees
set of salaries
Relations are usually displayed as
tables that enumerate the instances of
the relation. Columns of the tables are
often named; these names are called
attributes of the relation.

Natural Language Applications
The natural language front end parses
and interprets the query into conceptual
graph.
Example:
Handling queries such as Who hired
John Smith? or How much does John
Smith earn?.
Natural Language Applications

manager
Manager_of_hire
employee
salary
Employee_salary
employee
Natural Language Applications
Entry-relationship diagrams of the
manager_of_hire and employee_salary
relations.

hire
object
employee
agent
manager
Mana
ger_of
_hire
Knowledge entry for hire queries.
Natural Language Applications
Semantic interpretation of natural
language query

hire
object
Person:
John Smith
agent
Person: ?
Natural Language Applications
Expanded graph for query

hire
object
Employee:
John Smith
agent
Manager: ?
Mana
ger_of
_hire
Query in SQL data
base language
SELECT MANAGER
FROM MANAGER_OF_HIRE
WHERE EMPLOYEE = JOHN SMITH
Natural Language Applications
The agent and object of the original query
were known only to be of type person. To join
these with the knowledge base entry for hire,
they were first restricted to types manager
and employee respectively. The type
hierarchy could thus be used to perform type
checking on the original query. If John Smith
were not of type employee, the question
would be invalid and the program
could detect this.
Natural Language Applications
Once the expanded query graph is built,
the program examines the target concept,
flagged with a ?, and determines that the
manager_of_hire relation mapped a key onto
this concept. Because the key is bound to a
value of john smith, the question was valid
and the program could form the proper data
base query. Translation of the entity
relationship graph into SQL or some other
language is straightforward.
Natural Language Applications
Although this example is simplified, it
illustrates the use of a knowledge-based
approach to building a natural language
data base front end. The ideas in our example
are expressed in conceptual graphs but could
be mapped into other representations such as
frames or logic-based languages.

Vous aimerez peut-être aussi