- #10 page 78
- Write a "half-sister" rule in prolog.
A half sister is: (1) female, (2) has a common parent,
but does not have both parents the same.
halfSister(X,H) :- parent(X,P), parent(H,P),
parent(X,PX), not(PX = P),
parent(H,PH), not(PH = P).
- Run nlp2 and see what sentences can be generated. Run script
and then load nlp2. Run it with the Goal S(X). Repeat ";"
to run through alternatives.
- Extend NLP2 to handle simple "art adj noun" noun phrases also.
np(X, Y):- art(X, Z), noun(Z, Y).
np(X, Y):- art(X, Z), adj(Z, W), noun(W, Y).
- Extend NLP2 to handle simple "art ADJL noun" phrases also.
np(X, Y):- art(X, Z), noun(Z, Y).
np(X, Y):- art(X, Z), adjList(Z, W), noun(W, Y).
adjList(X, Y) :- adj(X,Y).
adjList(X, Y) :- adj(X,Z), adjList(Z,Y).