20.07.2013 Views

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Stabler - Lx 185/209 2003<br />

(5) Notati<strong>on</strong>: Sequences are written in various ways:<br />

abc<br />

〈a, b, c〉<br />

a, b, c<br />

[a, b, c]<br />

The programming language prolog requires the last format; otherwise, I try to choose the notati<strong>on</strong> to<br />

minimize c<strong>on</strong>fusi<strong>on</strong>.<br />

Similarly, the empty sequence is sometimes represented ɛ, but the prolog notati<strong>on</strong> is [].<br />

A stack is a sequence too, but with limitati<strong>on</strong>s <strong>on</strong> how we can access its elements: elements can <strong>on</strong>ly<br />

be read or written <strong>on</strong> the “top” <strong>of</strong> the sequence. We adopt the c<strong>on</strong>venti<strong>on</strong> that the top <strong>of</strong> a stack is <strong>on</strong><br />

the left, it is the “fr<strong>on</strong>t” <strong>of</strong> the sequence.<br />

(6) Notati<strong>on</strong>: C<strong>on</strong>text free grammars are comm<strong>on</strong>ly written in the familiar rewrite notati<strong>on</strong>, which we will<br />

use extensively in these notes:<br />

S → NP VP<br />

NP → DN VP→ VNP<br />

NP → N VP → V<br />

N → students V → sang<br />

N → s<strong>on</strong>gs V → knew<br />

D → some<br />

D → all<br />

These grammars are sometimes written in the more succinct Backus-Naur Form (BNF) notati<strong>on</strong>:<br />

S ::= NP VP<br />

NP ::= D N | N VP ::= V NP | V<br />

N ::= students | s<strong>on</strong>gs V ::= sang | knew<br />

D ::= some | all<br />

The categories <strong>on</strong> the left side <strong>of</strong> the ::= are expanded as indicated <strong>on</strong> the right, where the vertical bar<br />

separates alternative expansi<strong>on</strong>s. (Sometimes in BNF, angle brackets or italics are used to distinguish<br />

category from terminal symbols, rather than the capitalizati<strong>on</strong> that we have used here.) This kind <strong>of</strong><br />

BNF notati<strong>on</strong> is <strong>of</strong>ten used by logicians, and we will use it in the following chapter.<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!