; ======================================================================= ; FILENAME: c2 ; DATE: from Sep 30 2008 to ; PROGRAMMER: Nan Meng ;; this template version: snepsul-template.demo-20061005.txt ; Lines beginning with a semi-colon are comments. ; Lines beginning with "^" are Lisp commands. ; All other lines are SNePSUL commands. ; ; To use this file: run SNePS; at the SNePS prompt (*), type: ; ; (demo "c.demo" :av) ; ; Make sure all necessary files are in the current working directory ; or else use full path names. ; ======================================================================= ; Turn off inference tracing. ; This is optional; if tracing is desired, then delete this. ^(setq snip:*infertrace* nil) ; Load the appropriate definition algorithm: ;; UNCOMMENT THE ONE YOU *DO* WANT ;; AND DELETE THE OTHER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^(load "/projects/rapaport/CVA/STN2/defun_noun.cl") ;; ^(load "~/defun_noun.cl") ; Clear the SNePS network: (resetnet) ; OPTIONAL: ; UNCOMMENT THE FOLLOWING CODE TO TURN FULL FORWARD INFERENCING ON: ; ; ;enter the "snip" package: ^(in-package snip) ; ; ;turn on full forward inferencing: ^(defun broadcast-one-report (represent) (let (anysent) (do.chset (ch *OUTGOING-CHANNELS* anysent) (when (isopen.ch ch) (setq anysent (or (try-to-send-report represent ch) anysent))))) nil) ; ;re-enter the "sneps" package: ^(in-package sneps) ; load all pre-defined relations: ; (intext "/projects/rapaport/CVA/STN2/demos/rels") ^(load "~/rels") ; (define agent object antonym lex member class rel location proper-name property possessor part whole superclass subclass synonym before after duration arg1 arg2 object1 object2 to class-mod class-head indobj mode skf) ; load all pre-defined path definitions: ; ^(load "~/paths") ; (intext "/projects/rapaport/CVA/mkb3.CVA/paths/paths") ; BACKGROUND KNOWLEDGE: ; ===================== ; (put annotated SNePSUL code of your background knowledge here) ;; Slave masters put bounties on their slaves. (describe (add forall ($sm $sl) &ant ( (build member *sm class (build class-mod (build lex "slave") class-head (build lex "master"))) (build member *sl class (build lex "slave")) (build object *sl rel (build lex "slave") possessor *sm)) cq ( (build agent *sm act (build action (build lex "put") object (build lex "bounty") indobj *sl)))) = master-put-bounty-on-slave) ;; If A puts bounty on something STH and B returns that thing to A, then B gets rewards (from A). (describe (add forall ($a $b $sth) &ant ( (build agent *a act (build action (build lex "put") object (build lex "bounty") indobj *sth)) (build agent *b act (build action (build lex "return") object *sth indobj *a))) cq ( (build agent *b act (build action (build lex "get") object (build lex "reward") indobj *a)))) = bounty-return-reward) ;; Reward and benefit are synonyms. (describe (add synonym (build lex "reward") synonym (build lex "benefit"))) ;; Bounty and reward are synonyms. (describe (add synonym (build lex "bounty") synonym (build lex "reward"))) ;; Bounty hunters want bounty. (describe (add forall $b ant ( (build member *b class (build class-mod (build lex "bounty") class-head (build lex "hunter")))) cq ( (build agent *b act (build action (build lex "want") object (build lex "bounty"))))) = bounty-hunter-want-bounty) ;; The concept of bounty hunter, has proper-name "bounty hunter" (describe (add object (build class-mod (build lex "bounty") class-head (build lex "hunter")) proper-name (build lex "bounty\ hunter")) = bounty-hunter-proper-name) (describe (add object (build class-mod (build lex "slave") class-head (build lex "master")) proper-name (build lex "slave\ master")) = slave-master-proper-name) (describe (add forall ($a $c $n) &ant ( (build member *a class *c) (build object *c proper-name *n)) cq ( (build member *a class *n))) = member-class-proper-name) ;; If A is a bounty hunter, and B puts bounty on C, and A catches C, then A returns C to B (and gets bounty from B). (describe (add forall ($a $b $c) &ant ( (build member *a class (build class-mod (build lex "bounty") class-head (build lex "hunter"))) (build agent *b act (build action (build lex "put") object (build lex "bounty") indobj *c)) (build agent *a act (build action (build lex "catch") object *c))) cq ( (build agent *a act (build action (build lex "return") object *c indobj *b)))) = bounty-hunter-catch-return) ;; If A is a bounty hunter, and B puts bounty on C, and A sees C, then A catches C. (describe (add forall ($a $b $c) &ant ( (build member *a class (build class-mod (build lex "bounty") class-head (build lex "hunter"))) (build agent *b act (build action (build lex "put") object (build lex "bounty") indobj *c)) (build agent *a act (build action (build lex "see") object *c))) cq ( (build agent *a act (build action (build lex "catch") object *c)))) = bounty-hunter-see-catch) ;; If A returns C to B, then B gets C, and B gets C from A. (describe (add forall ($a $b $c) ant ( (build agent *a act (build action (build lex "return") object *c indobj *b))) cq ( build min 2 max 2 arg ( (build agent *b act (build action (build lex "get") object *c)) (build agent *b act (build action (build lex "get") object *c indobj *a))))) = return-get-from) ;; If A sniggers, then A is happy (smug). (describe (add forall $a ant ( build agent *a act (build action (build lex "snigger"))) cq ( (build object *a property ( (build lex "smug") (build lex "mean")))))) (describe (add forall ($a $b) &ant ( (build agent *a act (build action (build lex "return") object *b)) (build member *b class (build lex "slave"))) cq ( (build object *a property (build lex "evil"))))) ;; If A sniggers, then A laughs for him/herself. (describe (add forall $a ant ( (build agent *a act (build action (build lex "snigger")))) cq ( (build agent *a act (build action (build lex "laugh") indobj *a)))) = snigger-laugh-for) ;; If A laughs for him/herself, then A gets some benefit. (describe (add forall $a ant ( (build agent *a act (build action (build lex "laugh") indobj *a))) cq ( build agent *a act (build action (build lex "get") object (build lex "benefit")))) = laugh-for-get-benefit) ;; If A takes action ACT directly on B, B and C are synonyms, then A takes action ACT directly on C. (describe (add forall ($a $b $c $act) &ant ( (build synonym *b synonym *c) (build agent *a act (build action *act object *b))) cq ( build agent *a act (build action *act object *c))) = action-synonym-direct) ;; If A takes action ACT directly on B indirectly on D, B and C are synonyms, then A takes action ACT directly on C indirectly on D. (describe (add forall ($a $b $c $d $act) &ant ( (build synonym *b synonym *c) (build agent *a act (build action *act object *b indobj *d))) cq ( build agent *a act (build action *act object *c indobj *d))) = action-synonym-direct-indirect) ;; If A takes action ACT directly on C, and B is a member of class C, then A takes action ACT directly on B. (describe (add forall ($a $b $c $act) &ant ( (build member *b class *c) (build agent *a act (build action *act object *c))) cq ( build agent *a act (build action *act object *b))) = action-member-direct) ;; If A takes action ACT directly on C indirectly on D, and B is a member of class C, then A takes action ACT directly on B indirectly on D. (describe (add forall ($a $b $c $d $act) &ant ( (build member *b class *c) (build agent *a act (build action *act object *c indobj *d))) cq ( build agent *a act (build action *act object *b indobj *d))) = action-member-direct-indirect) ;; If A wants B, and A gets B, then A is happy. (describe (add forall ($a $b) &ant ( (build agent *a act (build action (build lex "want") object *b)) (build agent *a act (build action (build lex "get") object *b))) cq ( build object *a property (build lex "happy"))) = want-get-happy) ;; If something E is A's expectation, then E is an expectation, and A wants E. (describe (add forall ($a $e) ant ( build object *e rel (build lex "expectation") possessor *a) cq ( build min 2 max 2 arg ( (build member *e class (build lex "expectation")) (build agent *a act (build action (build lex "want") object *e))))) = expect-want) ;; If A wants E, then E is A's expectation. (describe (add forall ($a $e) ant ( build agent *a act (build action (build lex "want") object *e)) cq ( build object *e rel (build lex "expectation") possessor *a)) = want-expect) ;; If A sniggers, and something E is A's expectation, then A gets E. (describe (add forall ($a $e) ant ( build agent *a act (build action (build lex "snigger"))) cq ( build min 2 max 2 arg ( (build object #expectation rel (build lex "expectation") possessor *a) (build agent *a act (build action (build lex "get") object *expectation))))) = snigger-get-expect) ;; If A wants bounty, then A is a bounty hunter. (describe (add forall $a ant ( (build agent *a act (build action (build lex "get") object (build lex "bounty")))) cq ( build member *a class (build class-mod (build lex "bounty") class-head (build lex "hunter")))) = want-bounty-bounty-hunter) ; CASSIE READS THE PASSAGE: ; ========================= ;; Sethe is a runaway female slave. ; There is someone named Sethe. (describe (add object #sethe proper-name (build lex "Sethe")) = someone-is-named-sethe) ; Sethe is a slave. (describe (add member *sethe class (build lex "slave")) = sethe-is-a-slave) ; Someone is a slave master. (describe (add member #master class (build class-mod (build lex "slave") class-head (build lex "master"))) = someone-is-a-slavemaster) ; Sethe is the master's slave. (describe (add object *sethe rel (build lex "slave") possessor *master) = sethe-is-masters-slave) ;; A pateroller passing would have sniggered to see two throwaway people, two lawless outlaws --- a slave and a barefoot white woman with unpinned hair --- wrapping a ten-minute-old baby in the rags they wore. ; There is someone named Amy (describe (add object #amy proper-name (build lex "Amy"))) ; "pateroller" is an unknown word. (describe (add object (build lex "pateroller") property (build lex "unknown")) = pt-unknown) ; Someone is a pateroller. (describe (add member #pt class (build lex "pateroller"))) ; Pateroller sees Sethe and Amy. (describe (add agent *pt act (build action (build lex "see") object (*sethe *amy))) = pt-see-sethe-amy) ; If a pateroller A sees Sethe and Amy, then A will snigger. (describe (add forall $p &ant ( (build member *p class (build lex "pateroller")) (build agent *p act (build action (build lex "see") object (*sethe *amy)))) cq ( (build agent *p act (build action (build lex "snigger"))))) = pt-see-snigger) ; Sethe and Amy are outlaws. (describe (add member (*sethe *amy) class (build lex "outlaw")) = sethe-amy-outlaw) ^(defineNoun "pateroller")