; ======================================================================= ; FILENAME: cd-test.demo ; DATE: 4/4/2005 ; PROGRAMMER: Chris Becker ;; this template version: template.demo.2003.11.17.txt ; Lines beginning with a semi-colon are comments. ; Lines beginning with "^" are Lisp commands. ; All other lines are SNePS commands. ; ; To use this file: run SNePS; at the SNePS prompt (*), type: ; ; (demo "cd-test.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; ;^(setq snip:*infertrace* nil) ; Load the verb definition algorithm: ^(load "verbalgorithm3.1/defun_verb.cl") ; Clear the SNePS network: (resetnet t) ;turn on full forward inferencing: ^(setq snip:*infertrace* nil) ; ;enter the "snip" package: ^(in-package snip) ^(defun broadcast-one-report (rep) (let (anysent) (do.chset (ch *OUTGOING-CHANNELS* anysent) (when (isopen.ch ch) (setq anysent (or (try-to-send-report rep ch) anysent))))) nil) ^(in-package sneps) ; load all pre-defined relations: (intext "rels") ; load all pre-defined path definitions: (intext "paths") (intext "knowledge") ;;---------------------------------------------------------------- ;;---------------------------------------------------------------- ;; Examples in this demo: ; 1. PTRANS1: gave ; 2. PTRANS2: drove ; 3. PTRANS3: went ; 4. MTRANS1: showed ; 5. MTRANS2: told ; 6. PTRANS4: sent ; 7. ATRANS: spent ; 8. MOVE: waved ; 9. MBUILD: thought ; 10. INGEST: ate ; 11. GRASP: took ; 12. PROPEL: pushed () ;; Top level knowledge (describe (add subclass (build lex "person") = person superclass *entity)) (describe (add subclass (build lex "book") = book superclass *physical_object)) (describe (add subclass (build lex "street") = street superclass *location)) (describe (add subclass (build lex "office") = office superclass *location)) (describe (add subclass (build lex "information") = information superclass *abstraction)) (describe (add subclass (build lex "package") = package superclass *physical_object)) (describe (add subclass (build lex "business") = business superclass *entity)) (describe (add subclass (build lex "capital") = capital superclass *abstraction)) (describe (add subclass (build lex "idea") = idea superclass *abstraction)) (describe (add subclass (build lex "fruit") = fruit superclass *consumable_substance)) (describe (add subclass (build lex "cup") = cup superclass *physical_object)) (describe (add subclass (build lex "hand") = hand superclass *external_body_part)) (describe (add subclass (build lex "lift") = lift superclass *physical_object)) (describe (add subclass (build lex "box") = box superclass *physical_object)) ;; Example 1 background knowledge (describe (add object #Chris proper-name (build lex "Chris"))) (describe (add member Chris class *person)) (describe (add member the_book class *book)) (describe (add object #John proper-name (build lex "John"))) (describe (add member John class *person)) ;; Example 2 background knowledge (describe (add member main_street class *street)) (describe (add member maple_str class *street)) ;; Example 3 background knowledge (describe (add member the_office class *office)) ;; Example 4 background knowledge (describe (add member the_story class *information)) ;; Example 5 background knowledge (describe (add object #Mary proper-name (build lex "Mary"))) (describe (add member Mary class *person)) (describe (add object #Bill proper-name (build lex "Bill"))) (describe (add member Bill class *person)) ;; Example 6 background knowledge (describe (add member the_package class *package)) ;; Example 7 background knowledge (describe (add member the_business class *business)) (describe (add member stock class *capital)) (describe (add member shareholders class *person)) ;; Example 8 background knowledge (describe (add member his_hands class *hand)) ;; Example 9 background knowledge (describe (add member plan class *idea)) ;; Example 10 background knowledge (describe (add member pomegranate class *fruit)) ;; Example 11 background knowledge (describe (add member the_cup class *cup)) ;; Example 12 background knowledge (describe (add member the_lift class *lift)) (describe (add member the_box class *box)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 1 ;;; PTRANS1 ;;; agent "entity" ;;; object "physical object" ;;; to "location" ;;; ;;; "Chris gave the book to john (describe (add agent Chris act (build action (build lex "gave") = gave object the_book to John))) ^(defineVerb 'gave) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 2 ;;; PTRANS2 ;;; ;;; agent "entity" ;;; from "location" ;;; to "location" ;;; ;;; "Chris drove from main street to maple" (describe (add agent Chris act (build action (build lex "drove") = drove from main_street to maple_str))) ^(defineVerb 'drove) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 3 ;;; PTRANS3 ;;; ;;; agent "entity" ;;; to "location" ;;; ;;; "Chris went to the office" (describe (add agent Chris act (build action (build lex "went") = went to the_office))) ^(defineVerb 'went) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 4 ;;; MTRANS1 ;;; ;;; agent "entity" ;;; object "entity" ;;; indobj "abstraction" ;;; ;;; "Chris showed John the story" (describe (add agent Chris act (build action (build lex "showed") = showed object John indobj the_story))) ^(defineVerb 'showed) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 5 ;;; MTRANS2 ;;; ;;; agent "entity" ;;; object (act) ;;; to "entity" ;;; ;;; "Chris told John that Mary saw Bill" (describe (add agent Chris act (build action (build lex "told") = told object John indobj (build agent Mary act (build action (build lex "saw") = saw object Bill))))) ^(defineVerb 'told) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 6 ;;; PTRANS4 ;;; ;;; agent "entity" ;;; object "entity" ;;; indobj "physical object" ;;; ;;; "Chris sent John the package" (describe (add agent Chris act (build action (build lex "sent") = sent object John indobj the_package))) ^(defineVerb 'sent) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 7 ;;; ATRANS ;;; ;;; agent "entity" ;;; object "abstraction" ;;; to "entity" ;;; "the business offered stock to its shareholders" (describe (add agent the_business act (build action (build lex "offered") = offered object stock to shareholders))) ^(defineVerb 'offered) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 8 ;;; MOVE1 ;;; agent "entity" ;;; object "external body part" ;;; ;;; Bill waved his hands (describe (add agent Bill act (build action (build lex "waved") = waved object his_hands))) ^(defineVerb 'waved) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 9 ;;; MBUILD ;;; ;;; agent "entity" ;;; object "abstraction" ;;; ;;; "I thought of a plan" (describe (add agent Chris act (build action (build lex "thought") = thought object plan))) ^(defineVerb 'thought) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 10 ;;; INGEST ;;; agent "entity" ;;; object "consumable substance" ;;; ;;; "Chris ate a pomegranate." (describe (add agent Chris act (build action (build lex "ate") = ate object pomegranate))) ^(defineVerb 'ate) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 11 ;;; GRASP ;;; ;;; agent "entity" ;;; object "physical object" ;;; instrument "external body part" ;;; "Chris took the cup in his hands" (describe (add agent Chris act (build action (build lex "took") = took object the_cup instrument his_hands))) ^(defineVerb 'took) () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Example 12 ;;; PROPEL ;;; agent "entity" ;;; onto "physical object" ;;; ;;; "John pushed the box onto the lift" (describe (add agent John act (build action (build lex "pushed") = pushed object the_box onto the_lift))) ^(defineVerb 'pushed)