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

feature(Attribute, Node, Value) :- features(Node, Features), member(Attribute:Value, Features).<br />

(12) Let’s say that a terminal node is a leaf with ph<strong>on</strong>etic c<strong>on</strong>tent, and an empty node is a leaf with no<br />

ph<strong>on</strong>etic c<strong>on</strong>tent:<br />

terminal(n(_,_/ -Word,_), Word).<br />

empty(n(_,_/[],_)).<br />

n<strong>on</strong>empty(Node) :- terminal(Node).<br />

n<strong>on</strong>empty(Node) :- children(Node,[_|_]).<br />

(13) To extend a set <strong>of</strong> features at a node, it is c<strong>on</strong>venient to have:<br />

add_feature(Node0, Attribute, Value, Node) :category(Node0,<br />

Category), category(Node, Category),<br />

barlevel(Node0, Barlevel), barlevel(Node, Barlevel),<br />

extended(Node0, EP), extended(Node, EP),<br />

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

( member(Attribute:Value0, Features0)<br />

-> Value = Value0, Features = Features0<br />

; Features = [Attribute:Value|Features0]<br />

).<br />

And to copy the values <strong>of</strong> a list <strong>of</strong> attributes:<br />

copy_features([], OldFeatures, []).<br />

copy_features([Att|Atts], OldFeatures, Features0) :-<br />

( member(Att:Val, OldFeatures)<br />

-> Features0 = [Att:Val|Features]<br />

; Features0 = Features<br />

),<br />

copy_features(Atts, OldFeatures, Features).<br />

65

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

Saved successfully!

Ooh no, something went wrong!