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 />

6.5.2 Bottom-up oracles: lookahead<br />

(44) In top-down parsing, there is no point in using an expansi<strong>on</strong> p:-q, r if the next symbol to be parsed<br />

could not possibly be the beginning <strong>of</strong> a q.<br />

To guide top-down steps, it would be useful to know what symbol (or what k symbols) are next, waiting<br />

to be parsed. This “bottom-up” informati<strong>on</strong> canbeprovidedwitha“lookaheadoracle.”<br />

Obviously, the “lookahead” oracle does not look into the future to hear what has not been spoken yet.<br />

Rather, structure building waits for a word (or in general, k words) to be heard.<br />

Again, we will precompute, for each category p, what the first k symbols <strong>of</strong> the string could be when<br />

we are recognizing that category in a successful derivati<strong>on</strong> <strong>of</strong> any sentence.<br />

(45) In calculating lookahead, we ignore the triggers.<br />

One kind <strong>of</strong> situati<strong>on</strong> that we must allow for is this. If p:-q1,...,qn and q1,...,qi ⇒∗ ɛ, then every next<br />

symbol for qi+1 is a next symbol for p.<br />

(46) For any S ∈ Σ∗ ,letfirstk(S) be the first k symbols <strong>of</strong> S if |S| ≥k, and otherwise firstk(S) = S.<br />

We can use the following reas<strong>on</strong>ing to calculate all <strong>of</strong> the next k words that can be waiting to be parsed<br />

as each category symbol is expanded. For some k>0:<br />

wLAw [axiom] if w ∈ Σ<br />

xLAp [axiom]<br />

x1LAq1 ... xnLAqn<br />

xLAp<br />

if p:-q1,...,qn<br />

and either x = q1,...,qk ∈ Σ k for k ≤ n, or x = q1,...,qn ∈ Σ n for n

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

Saved successfully!

Ooh no, something went wrong!