Next: Writing a Grammar Up: Natural Language Processing Previous: The Problem

Syntax

The stage of syntactic analysis is the best understood stage of natural language processing. Syntax helps us understand how words are grouped together to make complex sentences, and gives us a starting point for working out the meaning of the whole sentence. For example, consider the following two sentences:

(1) The dog ate the bone.
(2) The bone was eaten by the dog.

The rules of syntax help us work out that it's the bone that gets eaten and not the dog. A simple rule like ``its the second noun that gets eaten'' just won't work.

Syntactic analysis allows us to determine possible groupings of words in a sentence. Sometimes there will only be one possible grouping, and we will be well on the way to working out the meaning. For example, in the following sentence:

(3) The rabbit with long ears enjoyed a large green lettuce.

we can work out from the rules of syntax that ``the rabbit with long ears'' forms one group (a noun phrase), and ``a large green lettuce'' forms another noun phrase group. When we get to work on working out the meaning of the sentence we can start off by working out the meaning of these word groups, before combining them together to get the meaning of the whole sentence.

In other cases there may be many possible groupings of words. For example, the sentence ``John saw Mary with a telescope'' there are two different readings based on the following groupings:

(i) John saw (Mary with a telescope). ie, Mary has the telescope.
(ii) John (saw Mary with a telescope). ie, John saw her with the telescope.

When there are many possible groupings then the sentence is syntactically ambiguous. Sometimes we will be able to use general knowledge to work out which is the intended grouping - for example, consider the following sentence:

(4) I saw the Forth bridge flying into Edinburgh.

We can probably guess that the Forth bridge isn't flying! So, this sentence is syntactically ambigous, but unambiguous if we bring to bear general knowledge about bridges. The ``John saw Mary ..'' example is more seriously ambiguous, though we may be able to work out the right reading if we know something about John and Mary (is John in the habit of looking at girls through a telescope?).

Anyway, rules of syntax specify the possible organisations of words in sentences. They are normally specified by writing a grammar for the language. Of course, just having a grammar isn't enough to analyse the sentence - we need a parser to use the grammar to analyse the sentence. The parser should return possible parse trees for the sentence, indicating the possible groupings of words into higher level syntactic sections. The next section will describe how simple grammars and parsers may be written, focusing on Prolog's built in direct clause grammar formalism.




Next: Writing a Grammar Up: Natural Language Processing Previous: The Problem


alison@
Fri Aug 19 10:42:17 BST 1994