Skip to content

Instantly share code, notes, and snippets.

@alexpdp7
Created September 9, 2022 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpdp7/f031e1c4d9908d6d901e9938658c4f8d to your computer and use it in GitHub Desktop.
Save alexpdp7/f031e1c4d9908d6d901e9938658c4f8d to your computer and use it in GitHub Desktop.
Scryer parsing experiments
?- [user].
sentence(s(NP,VP)) --> noun_phrase(NP), verb_phrase(VP).
noun_phrase(np(D,N)) --> det(D), noun(N).
verb_phrase(vp(V,NP)) --> verb(V), noun_phrase(NP).
det(d("the")) --> "the".
det(d("a")) --> "a".
noun(n("bat")) --> "bat".
noun(n("cat")) --> "cat".
verb(v("eats")) --> "eats".
^D
?- sentence(Parse_tree, "thebateatsacat", []).
Parse_tree = s(np(d("the"),n("bat")),vp(v("eats"),np(d("a"),n("cat"))))
; false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment