; ======================================================================= ; FILENAME: gnomic-demo.txt ; DATE: 5_12_11 ; PROGRAMMER: Richard Doell ; 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 "rdfoell-GNOMIC-demo.txt" :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) ;Using a custom 'algorithm' for adjective ; Clear the SNePS network: (resetnet t) ; OPTIONAL: ; UNCOMMENT THE FOLLOWING CODE TO TURN FULL FORWARD INFERENCING ON: ; ;enter the "snip" package: ^(in-package snip) ; Leave ffi off ; ^(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: ; NB: If "intext" causes a "nil not of expected type" error, ; then comment-out the "intext" command and then ; uncomment & use the load command below, instead ^(load "/projects/rapaport/CVA/STN2/demos/rels") ;(intext "/projects/rapaport/CVA/STN2/demos/rels") ; load all pre-defined path definitions: ;(intext "/projects/rapaport/CVA/mkb3.CVA/paths/paths") ^(load "/projects/rapaport/CVA/mkb3.CVA/paths/paths") ; Define a 'similar' arc to avoid problems with synonym semantics (define similar) ;this should define a path between asserted similar arcs (define-path (similar- ! similar)) ; BACKGROUND KNOWLEDGE: ; ===================== ; (put annotated SNePSUL code of your background knowledge here) ;Putting in some of the similars for enigmatic, using thesaurus.com and ; the Merriam-Webster online thesaurus (describe (assert similar (build lex "enigmatic") similar (build lex "ambiguous") similar (build lex "arcane") similar (build lex "cryptic") similar (build lex "dark") similar (build lex "incomprehensible") similar (build lex "obscure") similar (build lex "occult") similar (build lex "perplexing") similar (build lex "puzzling") similar (build lex "mysterious"))) ;Same, only for fragmentary ; Interestingly, fragmentary is the only one which has no similars among ; the other words (describe (assert similar (build lex "fragmentary") similar (build lex "broken") similar (build lex "incomplete") similar (build lex "disconnected") similar (build lex "incoherent") similar (build lex "partial"))) ;Now elusive (describe (assert similar (build lex "elusive") similar (build lex "evasive") similar (build lex "deceptive") similar (build lex "mysterious") similar (build lex "ambiguous") similar (build lex "incomprehensible") similar (build lex "indefinable") similar (build lex "insubstantial") similar *occult similar (build lex "puzzling"))) ;Finally mystical (describe (assert similar (build lex "mystical") similar *occult similar (build lex "arcane") similar (build lex "cryptic") similar (build lex "esoteric"))) ;Say that all the properties that directly describe the diary are mental concepts, things which are characteristics given ; by humans to things, ideas about things which don't exist outside the mind (giving a partial allowance to fragmentary for now, ; also using the 'sense' of elusive and fragmentary which are more 'inside the mind' than not): (describe (assert member ((build lex mystical) (build lex elusive) (build lex fragmentary) (build lex enigmatic)) class (build lex mental))) ;Now say that mental ideas are subclasses of the intensional group of things (describe (assert subclass (build lex mental) superclass (build lex intensional))) ; This will take care of the extensional or intensional categorization ; that was used in previous demos as two split rules, instead; this ; follows any/all subclass/superclass paths and says that if four things ; all have the same superclass, then the fifth thing is a member of that ; class. This will be used with the subclass/superclass assertion above ; to say that gnomic is 'intensional' because it is a superclass of the ; idea of mental concepts/ideas, of which fragmentary, elusive, mystical ; and enigmatic are members of. (describe (assert forall ($w $x $y $z $p $q $c) &ant( (build member *p class unknown) (build object *q property *w) (build object *q property *x) (build object *q property *y) (build object *q property *z) (build object *q property *p) (build subclass ((find (class- member) *w) (find (class- member) *x) (find (class- member) *y) (find (class- member) *z)) superclass (build lex *c))) cq (build member *p class (build lex *c)))) ; This is a slightly modified rule of the above, which says that if ; the adjectives are all of the same category, the unknown one is ; also in that category. (describe (assert forall ($w $x $y $z $s $p $q) &ant( (build member *p class unknown) (build object *q property *w) (build object *q property *x) (build object *q property *y) (build object *q property *z) (build object *q property *p) (build member (*w *x *y *z) class *s)) cq (build member *p class *s ))) ; The idea for the following series of rules is as follows: ; If four words have something in common, then the fifth has ; that word in common. ;Then, if that doesn't trigger, check again for the more general case ; where three of the words have something in common. Then, if that doesn't ; happen, then trigger the rule for if two things have common. The idea is ; to get the mots general, and hopefully most correct, data about the unknown ; word. To implement this functionality, uncomment the bits about min/max ;; The following assertion says that we know no similar words to gnomic ;(describe (assert min 0 max 0 arg (build (similar (build lex gnomic))))) ; This rule states that if an object has four properties, and they ; all have a similar word to each of them, then the unknown word, the ; fifth property, is also similar to that word. (describe (assert forall ($w $x $y $z $p $q) &ant( ; The properties all describe the same object ; Note: it's not actually possible to have all of these in one line- ; the original node which built them had to have the form of all arcs ; to one set. (build object *q property *p) (build object *q property *w) (build object *q property *x) (build object *q property *y) (build object *q property *z) ; p is unknown (build member *p class unknown)) cq ( build forall $s ; The main properties all share a similar word &ant( (build similar *w similar *s) (build similar *x similar *s) (build similar *y similar *s) (build similar *z similar *s)) cq (build similar *s similar *p)))) ; This rule states that if an object has three properties, and they ; all have a similar word to each of them, then the unknown word, the ; fourth property, is also similar to that word. (describe (assert forall ($x $y $z $p $q) &ant( ; The properties all describe the same object (build object *q property *p) (build object *q property *x) (build object *q property *y) (build object *q property *z) ;(build min 0 max 0 arg (build similar *p)) ; p is unknown (build member *p class unknown)) cq ( build forall $s ; The main properties all share a similar word &ant( (build similar *x similar *s) (build similar *y similar *s) (build similar *z similar *s)) cq (build similar *s similar *p)))) ; This rule states that if an object has two properties, and they ; all have a similar word to each of them, then the unknown word, the ; third property, is also similar to that word. (describe (assert forall ($x $y $p $q) &ant( ; The properties all describe the same object (build object *q property *p) (build object *q property *x) (build object *q property *y) ;(build min 0 max 0 arg (build similar *p)) ; p is unknown (build member *p class unknown)) cq ( build forall $s ; The main properties all share a similar word &ant( (build similar *x similar *s) (build similar *y similar *s)) ;(build similar *z similar *s)) cq (build similar *s similar *p)))) ; CASSIE READS THE PASSAGE: ; ========================= ; (put annotated SNePSUL code of the passage here) ; Post has a proper name of 'Post' (describe (add object #Post proper-name (build lex "Post"))) ; A diary is owned by Post (describe (add object #diary rel (build lex "diary") possessor *Post)) ; The diary is a diary (describe (add member *diary class (build lex "diary"))) ; The diary is enigmatic (describe (add object *diary property (build lex "enigmatic"))) ; The diary is fragmentary (describe (add object *diary property (build lex "fragmentary"))) ; The diary is elusive (describe (add object *diary property (build lex "elusive"))) ; The diary is mystical (describe (add object *diary property (build lex "mystical"))) ;The diary is 'gnomic,' which is a member of the ; class of unknown things (describe (add object *diary property (build lex "gnomic"))) ; Saying that the word gnomic is unknown (describe (add member (build lex "gnomic") class unknown)) ; Ask Cassie what "gnomic" means: ;First, ask what classes gnomic is in: (describe (find (class- ! member) (build lex gnomic))) ; Then, get the words which are 'similar' to it: (describe (findassert similar (build lex gnomic)))