procgen  Diff

Differences From Artifact [c3beb2da63]:

To Artifact [e796932c22]:


     1         -(include "bot.scm")
            1  +(include "lib/lisp-macro.scm")
            2  +(include "lib/bot.scm")
     2      3   
     3         -(define actors
     4         -  '#(me you thou they him her myself "your mother" "your mom" "your father"
     5         -	"your dad" "your aunt" "your uncle" "your dog"))
            4  +(rule (maybe x) (x) (""))
            5  +(rule (maybe_ x) (x " "))
            6  +(rule (maybe* x) ((x)) (""))
            7  +(rule (maybe_* x) ((x) " ") (""))
     6      8   
            9  +(bank pronoun 'me 'you 'thou 'they 'him 'her 'myself)
     7     10   (define pronouns '(
     8         -  (you    (nom . "you")  (acc . "you")  (gen . "your")  (poss . "yours")  )
     9         -  (thou   (nom . "thou") (acc . "thee") (gen . "thy")   (poss . "thine")  )
    10         -  (they   (nom . "they") (acc . "them") (gen . "their") (poss . "theirs") )
    11         -  (him    (nom . "he")   (acc . "him")  (gen . "his")   (poss . "his")    )
    12         -  (her    (nom . "her")  (acc . "her")  (gen . "hers")  (poss . "hers")   )
    13         -  (me	  (nom . "I")    (acc . "me")   (gen . "my")    (poss . "mine")   )
    14         -  (myself (nom . "I") 	 (acc . "myself") (gen . "my own") (poss . "my own"))))
           11  +  (you    (nom . "you")  (acc . "you")  (gen . "your")  (poss . "yours")  (cop . "you're"))
           12  +  (thou   (nom . "thou") (acc . "thee") (gen . "thy")   (poss . "thine")  (cop . "thou art"))
           13  +  (they   (nom . "they") (acc . "them") (gen . "their") (poss . "theirs") (cop . "they're"))
           14  +  (her    (nom . "her")  (acc . "her")  (gen . "her")   (poss . "hers")   (cop . "she's"))
           15  +  (him    (nom . "he")   (acc . "him")  (gen . "his")   (poss . "his")    (cop . "he's"))
           16  +  (me	  (nom . "I")    (acc . "me")   (gen . "my")    (poss . "mine")   (cop . "I'm"))
           17  +  (myself (nom . "I") 	 (acc . "myself") (gen . "my own") (poss . "my own") (cop . "I'm"))))
           18  +
           19  +(define (thy x) (string-append (inflect 'gen (pronoun)) " " x))
           20  +
           21  +(bank article 'def 'indef 'dem-prox 'dem-dist)
           22  +(define (decline art nm n)
           23  +  ; art = (def indef dem-prox dem-dist)
           24  +  (let* ([sg (if (pair? (cdr n)) (cadr n) (cdr n))]
           25  +		 [pl (if (pair? (cdr n)) (cddr n) (string-append sg "s"))]
           26  +		 [vwl (car n)]
           27  +		 [sel (if (eq? nm 'sg) sg pl)])
           28  +	(apply string-append (case art
           29  +	  ((def)  (list "the " sel))
           30  +	  ((indef) (case nm
           31  +				 ((sg) (case vwl
           32  +						 ((a) (list "a " sel))
           33  +						 ((an) (list "an " sel))))
           34  +				 ((pl) (list sel))))
           35  +	  ((dem-prox) (case nm
           36  +					((sg) (list "this " sel))
           37  +					((pl) (list "these " sel))))
           38  +	  ((dem-dist) (case nm
           39  +					((sg) (list "that " sel))
           40  +					((pl) (list "those " sel))))))))
           41  +
           42  +(bank relatives
           43  +	  "mother" "mom" "father" "dad" "aunt" "uncle" "dog" "friend" "granny"
           44  +	  "grandma" "grandfather" "grandpa" "grandmother")
           45  +(bank jobs
           46  +	  '(a . "banker")   '(a ."porn star") '(a . "general") '(a . "president") 
           47  +	  '(a . "janitor") '(an ."executive") '(a . ("sheep" . "sheep")) '(a . ("spy" . "spies"))
           48  +	  '(a . "fed") '(a . "war criminal"))
           49  +
           50  +(rule (actors)
           51  +	  ((pronoun))
           52  +	  ((thy (relatives)))
           53  +	  ((decline (article) (one-of 'sg 'pl) (jobs)))
           54  +	  ((inflect 'gen (pronoun)) " " (relatives)))
    15     55   
    16     56   (define (conjugate v t n)
    17     57     (if (eq? v 'cop)
    18         -	(case (cons t n)
           58  +	(case (cons t n) )))
    19     59   	
    20     60   
    21     61   (define (inflect c n)
    22     62     (if (string? n)
    23     63   	(case c
    24     64   	  ((nom acc)  n)
    25     65   	  ((gen poss cop) (string-append n "'s")))
    26     66   	; else
    27         -	(cdr (assq c (cdr (assq n pronouns))))))
           67  +	  (cdr (assq c (cdr (assq n pronouns))))))
           68  +
           69  +(bank organ
           70  +	  "balls" "gut" "face" "head" "nose" "brain" "heart"
           71  +	  "ass" "tits" "duodenum" "kidneys" "pooper")
    28     72   
    29     73   (rule (action victim)
    30         -  ("port " victim " to lisp")
    31         -  ("rain on " victim "'s parade"))
           74  +  ("port " (inflect 'acc victim) " to lisp")
           75  +  ("rain on " (inflect 'gen victim) " parade")
           76  +  ((one-of "shoot" "stab") " " (inflect 'acc victim) " in the " (organ))
           77  +  ("impale " (inflect 'acc victim)
           78  +   (@ ("") (" on " (one-of "the flagpole" "a spike" "the terrorspike"))))
           79  +  ("demolish " (inflect 'gen victim) " house")
           80  +  ("have " (inflect 'acc victim) " " (one-of "sent" "deported") " "
           81  +   (maybe "straight ") "to "
           82  +   (one-of "Siberia" "the north pole" "Betelgeuse" "the moon" "Cleveland")))
    32     83   
    33     84   (rule (subject actor)
    34     85     ((inflect 'cop actor) " gonna")
    35         -  ((inflect 'nom actor) " swear"))
           86  +  ((inflect 'cop actor) " " (one-of "fixing" "plotting" "planning" "scheming") " to"))
           87  +  ; ((inflect 'nom actor) " swear to"))
           88  +
           89  +(rule (clause actor victim)
           90  +	  ((subject actor) " " (action victim)))
    36     91     
    37         -(print
    38         -  (inflect
    39         -	(pick '#(nom acc gen poss))
    40         -	(pick actors)))
           92  +(print (clause (actors) (actors)))
           93  +  ; ((inflect
           94  +	; (pick '#(nom acc gen poss))
           95  +	; (pick actors)))
    41     96   
    42     97   ;(print (action "you"))