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

(19) The implementati<strong>on</strong> <strong>of</strong> the LC recognizer:<br />

/*<br />

* file: lc.pl<br />

*/<br />

:- op(1200,xfx,: ˜ ). % this is our object language "if"<br />

:- op(1100,xfx,? ˜ ). % metalanguage provability predicate<br />

[] ? ˜ [].<br />

(S0 ? ˜Goals0) :- infer(S0,Goals0,S,Goals), (S ? ˜Goals). infer(S,[-D,A|C],S,DC) :- (A : ˜ [D|Ds]), append(Ds,C,DC). % lc-complete<br />

infer(S,[-D|C],S,DAC) :- (A : ˜ [D|Ds]), append(Ds,[-A|C],DAC). % lc<br />

infer([W|S],[W|C],S,C). % shift-complete=scan<br />

infer([W|S],C,S,[-W|C]). % shift<br />

infer(S,[A|C],S,C) :- (A : ˜ []). % lc-e-complete<br />

infer(S,C,S,[-A|C]) :- (A : ˜ []). % lc-e<br />

append([],L,L).<br />

append([E|L],M,[E|N]) :- append(L,M,N).<br />

83

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

Saved successfully!

Ooh no, something went wrong!