;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; MOPs and phrases to test parser ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Defines the following phrases (and associated mops): ;;; ;;; butterflies => m-butterfly ;;; bug => m-insect, m-disease ;;; rat => m-rat ;;; kangaroo => m-kangaroo ;;; kangaroo rat => m-kangaroo-rat ;;; catch :object => m-catch-animal, m-get-disease ;;; ;;; Test cases: ;;; ;;; (test-parse '(catch a butterfly)) ;;; (test-parse '(catch a cold)) ;;; (test-parse '(catch a bug)) (defpackage #:creanimate (:use :common-lisp :mops :dmap) ) (in-package :creanimate) ;;; test-parse runs dmap on the test sentences and displays ;;; the concepts recognized. (defun test-parse (sent) (reset-cseqs) (with-monitors () (format t "Parsing ~S~%" sent) (parse sent :package 'creanimate))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; MOPs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; This particular content was inspired by Creanimate ;;; which used MOPs to describe short video clips ;;; of animal behavior. ;;; Clear out existing MOPs (clear-memory) (defmop m-mammal (m-animal)) (defmop m-fish (m-animal)) (defmop m-insect (m-animal)) (defmop m-walrus (m-mammal)) (defmop m-rat (m-mammal)) (defmop m-kangaroo (m-mammal)) (defmop m-kangaroo-rat (m-rat)) (defmop m-gillfish (m-fish)) (defmop m-butterfly (m-insect)) (defmop m-disease) (defmop m-cold-disease (m-disease)) (defmop m-catch-animal (m-action) :object m-animal) (defmop m-get-disease (m-action) :object m-disease) (defmop m-head-part (m-body-part)) (defmop m-tusk (m-head-part)) (defmop m-gill-cover (m-head-part)) (defmop m-lift-self (m-action)) (defmop m-move (m-behavior)) (defmop m-survive-drought (m-behavior)) (defmop i-walrus-lift-with-tusks (m-animal-motion-example) :animal m-walrus :feature m-tusk :action m-lift-self-with-tusks :behavior m-move) (defmop m-lift-self-with-tusks (m-lift-self) :inst m-move-tusks) (defmop m-move-tusks (m-move-body-part) :object m-tusk) (defmop i-gillfish-climb-trees (m-animal-motion-example) :animal m-gillfish :feature m-gill-cover :action m-lift-self-with-gill-covers :behavior m-survive-drought) (defmop m-lift-self-with-gill-covers (m-lift-self) :inst m-move-gill-covers) (defmop m-move-gill-covers (m-move-body-part) :object m-gill-covers) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Phrases ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Clear out any existing phrases (remove-all-cseqs) (defphrase m-insect bug) (defphrase m-butterfly a butterfly) (defphrase m-butterfly butterflies) (defphrase m-kangaroo kangaroo) (defphrase m-rat rat) (defphrase m-kangaroo-rat kangaroo rat) (defphrase m-disease bug) (defphrase m-cold-disease cold) (defphrase m-catch-animal catch (:object)) (defphrase m-get-disease catch (:object)) (provide "test-parse")