Hi,
On Mar 10, 6:47 am, Mike K <[email protected]> wrote:
> (defparameter *simple-grammar*
> '((sentence -> (noun-phrase verb-phrase))
> (noun-phrase -> (Article Noun))
> (verb-phrase -> (Verb noun-phrase))
> (Article -> the a)
> (Noun -> man ball woman table)
> (Verb -> hit took saw liked))
> "A grammar for a trivial subset of English.")
A quick guess:
(defparameter *simple-grammar*
{:sentence [:noun-phrase :verb-phrase]
:noun-phrase [:article :noun]
:verb-phrase [:verb :noun-phrase]
:article #{"the" "a"}
:noun #{"man" "ball" "woman" "table"}
:verb #{"hit" "took" "saw" "liked"}
"A grammar for a trivial subset of English.")
keywords represent non-terminals, strings are terminals, vectors
represent sequences, sets a choice. Things can nest more or less
arbitrary. A slightly more complicated example to show what I mean:
(defparameter *simple-grammar*
{:sentence [#{:noun-phrase :pronoun} :verb-phrase]
:noun-phrase [:article :noun]
:verb-phrase [:verb :noun-phrase]
:pronoun #{"he" "she" "it"}
:article #{"the" "a"}
:noun #{"man" "ball" "woman" "table"}
:verb #{"hit" "took" "saw" "liked"}
"A grammar for a trivial subset of English.")
Does this make sense?
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en