You are on page 1of 8

Chapter 2

Templates and Keywords

Template Matching
• ELIZA, Developed by Joseph Weizenbaum
– Turing Test : A machine should be considered
intelligent if a human communicated with it and
could not distinguish it from another human
– ELIZA, a program used to carry out an English
dialogue as a psychological counselor
– Illustrates how easy it is to deceive people
– Conversation done through pattern recognition
Chapter 2 Department of Computer Science, SUNY Oswego 2
CSC / ISC 350 - 810 Computational Linguistics Fall 2000

1
Other Template Systems
• ELIZA – Norvig, 1991 (Lisp)
– Joseph Weizenbaum, • HAL
1966 – English Language
• SIR Command Interface for
– Semantic Information Lotus 1-2-3
Retrieval
– Bertram Raphael, 1968
• STUDENT
– Bobrow, 1968
Chapter 2 Department of Computer Science, SUNY Oswego 3
CSC / ISC 350 - 810 Computational Linguistics Fall 2000

DOS Commands in English


• Purpose: translate English to DOS using a
template system
– less expressive than English
– human user can restrict expressiveness
– template will cover a small subset of English

Chapter 2 Department of Computer Science, SUNY Oswego 4


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

2
Steps in designing a
template system
• Start with sample input, find pattern in them
• Write a set of rules to perform the
translation
• Two types of translation rules:
simplification and translation
• Create the command using the translation
rules, then pass it to the operating system

Chapter 2 Department of Computer Science, SUNY Oswego 5


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

Implementing Simplification
• Use templates to match parts of sentences
and discard unnecessary words
• Storing the templates
– note: order of the simplification rules matter
• After one simplification, use the rules to try
and simplify the sentence further

Chapter 2 Department of Computer Science, SUNY Oswego 6


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

3
Implementing Translation
• Accomplished by mapping a template into
the formal language
• Translation rules are relatively simple
– each rule is supposed to match the whole list of
words
• Output of a translation rule is atomic
– if converted back and concatenated, the
appropriate DOS command is obtained
Chapter 2 Department of Computer Science, SUNY Oswego 7
CSC / ISC 350 - 810 Computational Linguistics Fall 2000

Keyword Analysis
• An alternate to template matching
• Blum (1966) created one of the first systems
• Not thrown off by slight variations
• Unrecognized words are skipped
• Useful in situations where input is known to
contain certain kinds of information

Chapter 2 Department of Computer Science, SUNY Oswego 8


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

4
Example : Database Querying
• Using keyword analysis, database queries
are processed
• Database terminology
– database; relational, flat file
– tables, tuples
– rows (records), attributes (fields)
– identifier (key), query, relation
– SQL
Chapter 2 Department of Computer Science, SUNY Oswego 9
CSC / ISC 350 - 810 Computational Linguistics Fall 2000

A Database in Prolog
• We need a database in order to experiment
with NL access to databases.
• Type database code in a file, then load it
into Prolog.
• This database is not fully functional, since it
is missing additional functionality, such as
the ability to update records.

Chapter 2 Department of Computer Science, SUNY Oswego 10


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

5
Building a Keyword System
• Keyword systems work with database
querying since important concepts have
distinct names.
• Such a system only responds to words that
identify fields, values and comparisons.
• Stages in a keyword system:
– simplify
– translate
Chapter 2 Department of Computer Science, SUNY Oswego 11
CSC / ISC 350 - 810 Computational Linguistics Fall 2000

Constructing a Query
• From the keyword systems’s point of view,
there are 5 kinds of words:
– actions
– tests
– comparisons
– arguments
– noise words

Chapter 2 Department of Computer Science, SUNY Oswego 12


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

6
Constructing a Query (2)
• The string of words must be translated to a
Prolog query.
• We can write rules to translate words into
queries.
• To implement the translation of an empty
list, we use the built-in predicate true.

Chapter 2 Department of Computer Science, SUNY Oswego 13


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

Lambda Abstraction
• Lambda abstraction, or lambda calculus is
the most useful technique in semantics.
• The Lambda expression describes the
function its referring to.
• It is used as a way to turn formulas into
properties.

Chapter 2 Department of Computer Science, SUNY Oswego 14


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

7
Lambdas in Prolog
• Lambdas are needed in Prolog in order to
indicate parts of formulas that is supplied
from outside - whether or not our intention
was to define a function or property.
• A Lambda expression is a two argument
term whose arguments are a variable and a
term in which that variable can occur.

Chapter 2 Department of Computer Science, SUNY Oswego 15


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

Ellipsis and Anaphora


• Ellipsis is the elimination of repeated
words.
• Example: Over 30000?
• Anaphora is the use of special words
(anaphors) to stand for things already
referred to.
• Example: he, she, it.

Chapter 2 Department of Computer Science, SUNY Oswego 16


CSC / ISC 350 - 810 Computational Linguistics Fall 2000

You might also like