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

children(Trace, []).<br />

% visible(Node) iff Node is maximal or minimal, and not a proper segment<br />

visible(Node) :- extended(Node, -), barlevel(Node, 2).<br />

visible(Node) :- extended(Node, -), barlevel(Node, 0).<br />

The predicate copy_phi_features, and the similar copy_psi_features are easily defined using our<br />

earlier predicate copy_features:<br />

phi_features([pers<strong>on</strong>, number, case, wh, index, th, finite]).<br />

psi_features([pers<strong>on</strong>, number, case, wh, index, th, finite,<br />

pr<strong>on</strong>ominal, anaphoric]).<br />

copy_phi_features(Node0, Node) :features(Node0,<br />

Features0), features(Node, Features),<br />

phi_features(Phi),<br />

copy_features(Phi, Features0, Features).<br />

copy_psi_features(Node0, Node) :features(Node0,<br />

Features0), features(Node, Features),<br />

psi_features(Psi),<br />

copy_features(Psi, Features0, Features).<br />

(21) With these definiti<strong>on</strong>s, substituti<strong>on</strong> cannot apply to the tree:<br />

x(i,2,[],-)<br />

x(d,2,[],-)<br />

juliet<br />

(22) The following tree, <strong>on</strong> the other hand, allows exactly <strong>on</strong>e substituti<strong>on</strong>:<br />

x(i,2,[],-)<br />

x(d,2,[],-) x(d,2,[],-)<br />

hamlet<br />

To avoid typing in the term that denotes this tree all the time, let’s add the axiom:<br />

tree(1,<br />

x(i,2,[],-)/[<br />

x(d,2,[],-)/[],<br />

x(d,2,[],-)/ -hamlet ]).<br />

Then we can compute the substituti<strong>on</strong> with a sessi<strong>on</strong> like this:<br />

| ?- tree(1,T),subtree(N,T),substituti<strong>on</strong>(N,NewN,Moved,Trace),subtree(NewN,NewT),tk_tree(NewT).<br />

N = n(root,x(i,2,[],-)/[x(d,2,[],-)/[],x(d,2,[],-)/ -(hamlet)],n<strong>on</strong>e),<br />

T = x(i,2,[],-)/[x(d,2,[],-)/[],x(d,2,[],-)/ -(hamlet)],<br />

NewN = n(root,x(i,2,[],-)/[x(d,2,[index:_A],-)/ -(hamlet),x(d,2,[index:_A],-)/[]],n<strong>on</strong>e),<br />

NewT = x(i,2,[],-)/[x(d,2,[index:_A],-)/ -(hamlet),x(d,2,[index:_A],-)/[]],<br />

Moved = n(1,x(d,2,[index:_A],-)/ -(hamlet),n(root,x(i,2,[],-)/[x(d,2,[index:_A],-)/ -(hamlet),x(d,2,[index:_A],-)/[]],n<strong>on</strong>e)),<br />

Trace = n(2,x(d,2,[index:_A],-)/[],n(root,x(i,2,[],-)/[x(d,2,[index:_A],-)/ -(hamlet),x(d,2,[index:_A],-)/[]],n<strong>on</strong>e)) ?<br />

yes<br />

And the tree NewT gets displayed:<br />

x(d,2,[index:A],-)<br />

hamlet<br />

x(i,2,[],-)<br />

70<br />

x(d,2,[index:A],-)

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

Saved successfully!

Ooh no, something went wrong!