Created
September 23, 2016 17:07
-
-
Save PythonJedi/b0e51c64154c36e5f8c268e0b1b7ce5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noun(man). | |
noun(ball). | |
verb(hit). | |
verb(took). | |
article(the). | |
% Handle splitting sublists | |
is_cat([], B, C) :- | |
B = C. | |
is_cat([A|AS], BS, [C|CS]) :- | |
A = C, | |
is_cat(AS, BS, CS). | |
verb_phrase(A) :- | |
[X|Y] = A, | |
verb(X), | |
noun_phrase(Y). | |
noun_phrase(A) :- | |
[X, Y] = A, | |
article(X), | |
noun(Y). | |
sentence(A) :- | |
is_cat(X, Y, A), | |
noun_phrase(X), | |
verb_phrase(Y). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment