splork-mode/sent-struct.lsp

121 lines
7.8 KiB
Common Lisp

(defvar *sentence-structures*)
(setf *sentence-structures* '((lambda ()
"The [random(<adjective>, .5)] <noun> [random(' in ' . <place>, .2)] is <adjective>"
(let* ((sentence ""))
(if (<= 5 (random 10))
(setf sentence (find-pos words "ADJECTIVE" 'false))
)
(setf sentence (format nil "~A ~A" sentence (find-pos words "NOUN" 'true)))
(if (<= 2 (random 10))
(setf sentence (format nil "~A in ~A" sentence (find-noun-with-article words)))
)
(setf sentence (format nil "~A is ~A" sentence (find-pos words "ADJECTIVE" 'false)))
sentence))
(lambda ()
"The [random(<adjective>, .5)] <noun> [random(' in ' . <place>, .2)] is not <adjective>"
(let* ((sentence ""))
(if (<= 5 (random 10))
(setf sentence (format nil "~A" (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A" sentence (find-noun-with-article words)))
(if (<= 2 (random 10))
(setf sentence (format nil "~A in ~A" sentence (find-noun-with-article words)))
)
(setf sentence (format nil "~A is not ~A" sentence (find-pos words "ADJECTIVE" 'false)))
sentence))
(lambda ()
"The <noun> from <place> will go to <place>"
(let* ((sentence ""))
(setf sentence (format nil "~A ~A from ~A will go to ~A" sentence (find-pos words "NOUN" 'false) (find-place-noun words) (find-place-noun words)))
sentence))
(lambda ()
"<name> must take the <adjective> <noun> from <place>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A must take the ~A from ~A" sentence (find-pos words "NOUN" 'true) (find-place-noun words)))
sentence))
(lambda ()
"<place> is <adjective> and the <noun> is <adjective>"
(let* ((sentence (find-place-noun words)))
(setf sentence (format nil "~A is ~A and the ~A is ~A" sentence (find-pos words "ADJECTIVE" 'false) (find-pos words "NOUN" 'true) (find-pos words "ADJECTIVE" 'false)))
sentence))
(lambda ()
"<name> <preposition> <place> for the <adjective> <noun>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A ~A ~A for the ~A ~A" sentence (find-pos words "PREPOSITION" 'false) (find-place-noun words) (find-pos words "ADJECTIVE" 'false) (find-pos words "NOUN" 'true)))
sentence))
(lambda ()
"The <noun> from the <place> <action> the <noun>"
(let* ((sentence ""))
(setf sentence (format nil "~A ~A from the ~A ~A the ~A" sentence (find-pos words "NOUN" 'true) (find-place-noun words) (find-pos words "VERB" 'false) (find-pos words "NOUN" 'true)))
sentence
))
(lambda ()
"The [random(<adjective>, .5)] <noun> <action> the <adjective> <noun> [random('in ' . <place>, .2]"
(let* ((sentence ""))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A ~A the ~A ~A" sentence (find-pos words "NOUN" 'true) (find-pos words "VERB" 'false) (find-pos words "ADJECTIVE" 'false) (find-pos words "NOUN" 'true)))
(if (<= 2 (random 10))
(setf sentence (format nil "~A in ~A" sentence (find-place-noun words)))
)
sentence))
(lambda ()
"<name> <preposition> <place> and <action> <noun>"
(let* ((sentence ""))
(setf sentence (format nil "~A ~A ~A and ~A ~A" (find-noun-with-article words) (find-pos words "PREPOSITION" 'false) (find-place-noun words) (find-pos words "VERB" 'false) (find-noun-with-article words)))
sentence))
(lambda ()
"<name> takes <pronoun> [random(<adjective>, .5)] <noun> and <preposition> <place>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A takes ~A" sentence (find-pos words "PRONOUN" 'false)))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A and ~A ~A" sentence (find-pos words "NOUN" 'true) (find-pos words "PREPOSITION" 'false) (find-place-noun words)))
sentence))
(lambda ()
"<name> <action> the [random(<adjective>, .5)] <noun>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A ~A the" sentence (find-pos words "VERB" 'false)))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A" sentence (find-pos words "NOUN" 'true)))
sentence))
(lambda ()
"<name> <action> <name> and <pronoun> [random(<adjective>, .5)] <noun>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A ~A ~A and ~A" sentence (find-pos words "VERB" 'false) (find-noun-with-article words) (find-pos words "PRONOUN" 'false)))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A" sentence (find-pos words "NOUN" 'true)))
sentence))
(lambda ()
"The <noun> is the [random(<adjective>,.5)] <noun>; <name> <preposition> <place>"
(let* ((sentence (find-noun-with-article words)))
(setf sentence (format nil "~A is the" sentence))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A; ~A ~A ~A" sentence (find-noun-with-article words) (find-noun-with-article words) (find-pos words "PREPOSITION" 'false) (find-place-noun words)))
sentence))
(lambda ()
"You must meet <name> at <place> and retrieve the [random(<adjective>, .5)] <noun>"
(let* ((sentence "You must meet"))
(setf sentence (format nil "~A ~A at ~A and retrieve the " sentence (find-noun-with-article words) (find-place-noun words)))
(if (<= 5 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A" sentence (find-noun-with-article words)))
sentence))
(lambda ()
"Without [random(<adjective>,.3)] <noun>, the <noun> <action> <preposition> <place>!"
(let* ((sentence "Without"))
(if (<= 3 (random 10))
(setf sentence (format nil "~A ~A" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setf sentence (format nil "~A ~A, ~A ~A ~A ~A!" sentence (find-pos words "NOUN" 'false) (find-noun-with-article words) (find-pos words "VERB" 'false) (find-pos words "PREPOSITION" 'false) (find-place-noun words)))
sentence))))