;;;FILENAME: importunate.demo ;;;DATE: 10 May 2007 ;;;PROGRAMMER: Nyurguyana Petrova ;;; ;;;INSTRUCTIONS on how to use this file: ;;;run SNePS: ;;; run lisp (type acl) ;;; :ld /projects/snwiz/bin/sneps ;;; change to package (type (sneps)) ;;;at the SNePS prompt (:), type: ;;;(demo "importunate.demo" :av) ;;; ;;;================================================================ ;;; ;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) ;;;================================================================ ;;;clears knowledge base (resetnet t) ;;;================================================================ ;;;Defining some SNePS relations: ;;;member/class ;;;object/property (define member class object property) ;;;================================================================ ;;;object/propername ;;;object/location ;;;lex ;;;object1 rel object2 (define object propername location lex rel) ;;;================================================================ ;;;cause/effect (define cause effect) ;;;================================================================ ;;;agent/act/action/object (define agent act action object) ;;;================================================================ ;;;PRIOR KNOWLEDGE ;;;================================================================ ;;;If someone is a person, and that person is in discomfort and in physical revulsion, ;;;then he/she is not ok. (describe (assert forall $x &ant ((build member *x class (build lex "person")) (build object *x property (build lex "discomfort")) (build object *x property (build lex "physical revulsion"))) cq (build object *x property (build lex "not-ok")))) ;;;================================================================ ;;;If X is an unknown concept & if a person becomes X ;;;& if a second person is not OK because the first person became X, ;;;then the first person is pushy because that person is X. ;;;More Specifically: ;;;------------------ ;;;If importunate is an unknown concept & if a person becomes importunate, ;;;& if a second person is not OK because the first person became importunate, ;;;then the first person is pushy because that person is importunate. (describe (assert forall ($x $p $q) &ant ((build object *x property (build lex "unknown")) (build object *p property *x) (build object *q property (build lex "not-ok")) (build cause (build object *p property *x) effect (build object *q property (build lex "not-ok")))) cq (build cause (build object *p property *x) effect (build object *p property (build lex "pushy"))))) ;;;================================================================ ;;;If X is an unknown concept ;;;& if a person becomes X ;;;& if a second person is not OK because the first person became X, ;;;then the first person is sexually aggressive because that person is X. ;;;More Specifically: ;;;------------------ ;;;If importunate is an unknown concept, ;;;& if a person becomes importunate, ;;;& if a second person is not OK because the first person became importunate, ;;;then the first person is sexually aggressive because that person is importunate. (describe (assert forall ($x $p $q) &ant ((build object *x property (build lex "unknown")) (build object *p property *x) (build object *q property (build lex "not-ok")) (build cause (build object *p property *x) effect (build object *q property (build lex "not-ok")))) cq (build cause (build object *p property *x) effect (build object *p property (build lex "sexually aggressive"))))) ;;;================================================================ ;;;If p is f because p is x ;;;& if p is x ;;;then p is f ;;;More Specifically: ;;;------------------ ;;;If person is pushy (or sexually aggressive) because person is importunate, ;;;& if person is importunate, ;;;then person is pushy (or sexually aggressive). (describe (assert forall ($p $f $x) &ant ((build cause (build object *p property *x) effect (build object *p property *f)) (build object *p property *x)) cq (build object *p property *f))) ;;;================================================================ ;;;Forall x y [x makes advances towards y ;;;& x is older than y ;;;then x is pushy and sexually aggressive towards y] (describe (assert forall ($x $y) &ant(build agent *x act (build action (build lex "makes advances towards") object *y)) &ant(build object1 *x rel (build lex "is older than") object2 *y) cq(build object1 ((build object *x property (build lex "pushy")) (build object *x property (build lex "sexually aggressive"))) rel (build lex "towards") object2 *y))) ;;;================================================================ ;;;Forall x y [x is pushy & sexually aggressive towards y ;;;then y feels discomfort and physical revulsion ;;;because x is pushy and sexually aggressive towards y] (describe (assert forall ($x $y) &ant((build object *x property (build lex "pushy")) (build object *x property (build lex "sexually aggressive")) (build object1 ((build object *x property (build lex "pushy")) (build object *x property (build lex "sexually aggressive"))) rel (build lex "towards") object2 *y)) cq (build cause (build object1 ((build object *x property (build lex "pushy")) (build object *x property (build lex "sexually aggressive"))) rel (build lex "towards") object2 *y) effect ((build object *y property (build lex "discomfort")) (build object *y property (build lex "physical revulsion")))))) ;;;================================================================ ;;;Forall y x f [y feels discomfort and physical revulsion ;;;because x is pushy and sexually aggressive towards y ;;;& y feels discomfort and physical revulsion because x is f ;;;& f is unknown ;;;then ;;;Forall p1 [p1 is f ;;;then p1 is pushy and sexually aggressive]] (describe (assert forall ($y $x $f) &ant (build cause (build object1 ((build object *x property (build lex "pushy")) (build object *x property (build lex "sexually aggressive"))) rel (build lex "towards") object2 *y) effect ((build object *y property (build lex "discomfort")) (build object *y property (build lex "physical revulsion")))) &ant(build cause (build object *x property *f) effect ((build object *y property (build lex "discomfort")) (build object *y property (build lex "physical revulsion")))) &ant(build object *f property (build lex "unknown")) cq(build forall $p1 ant(build object *p1 property *f) cq((build object *p1 property (build lex "pushy")) (build object *p1 property (build lex "sexually aggressive")))))) ;;;================================================================ ;;;FROM TEXT ;;;================================================================ ;;;Someone whose name is Philip (describe (add object #philip propername "Philip")) ;;;================================================================ ;;;Someone whose name is Wilkinson (describe (add object #wilkinson propername "Wilkinson")) ;;;================================================================ ;;;Philip and Miss Wilkinson are persons. (describe (add member (*philip *wilkinson) class (build lex "person"))) ;;;================================================================ ;;;Miss Wilkinson makes advances towards Philip. (describe (add agent *wilkinson act (build action (build lex "makes advances towards") object *philip))) ;;;================================================================ ;;;Miss Wilkinson is older than Philip. (describe (add object1 *wilkinson rel (build lex "is older than") object2 *philip)) ;;;================================================================ ;;;SNePS representation of the sentence from the text: ;;;As she becomes more importunate, though, ;;;Philip begins to feel discomfort and physical revulsion in her presence, <.>. ;;; ;;;From Maugham W. Somerset. (1915, 1991). Of Human Bondage. ;;; ;;;1). When Philip is in Miss Wilkinson's presence, he begins to feel discomfort and physical revulsion. ;;;2). Miss Wilkinson becomes (is) importunate. ;;;3). Philip feels discomfort and physical revulsion as Miss Wilkinson becomes (is) more importunate. ;;;================================================================ ;;;When Philip is in Miss Wilkinson's presence, he begins to feel discomfort and physical revulsion. (describe (add &ant ((build object *philip location #someplace) (build object *wilkinson location *someplace)) cq ((build object *philip property (build lex "discomfort")) (build object *philip property (build lex "physical revulsion"))))) ;;;==================================================== ;;;Philip and Miss Wilkinson are in the same place. (describe (add object (*philip *wilkinson) location *someplace)) ;;;================================================================ ;;;Miss Wilkinson becomes (is) importunate. (describe (add object *wilkinson property (build lex "importunate"))) ;;;================================================================ ;;;As Miss Wilkinson becomes importunate, Philip feels discomfort and physical revulsion. (describe (add cause (build object *wilkinson property (build lex "importunate")) effect ((build object *philip property (build lex "discomfort")) (build object *philip property (build lex "physical revulsion"))))) ;;;================================================================ ;;;Philip is not ok because Miss Wilkinson is importunate. (describe (add cause (build object *wilkinson property (build lex "importunate")) effect (build object *philip property (build lex "not-ok")))) ;;;================================================================ ;;;Word (importunate) is unknown. (describe (add object (build lex "importunate") property (build lex "unknown"))) ;;;================================================================ ;;;Description of the built network: (describe *nodes) ;;;================================================================ ;;;The command 'show' is used to create diagrams of a built network ;;;It shows a node m57! and automatically saves it in a current directory with ps extension (show m59 :file m59 :format ps) ;;;combined part of a network of nodes m59! m60! m61! m62! m63! ;;;showing definition inference (show m59 m60 m61 m62 m63 :file definition_inference :format ps) ;;;a node m8! ;(show m8 :file m8 :format ps) ;;;a node m10! ;(show m10 :file m10 :format ps) ;;;the combined network of nodes m8! m10! m59! m60! m61! m62! m63! (show m8 m10 m59 m60 m61 m62 m63 :file importunate_combined_nodes :format ps) ;;;a node m11! ;(show m11 :file m11 :format ps) ;;;a node m19!