;;;;; First load the root templates (see lecture 7 of part 1): ;;;;; -------------------------------------------------------- ;; (asdf:operate 'asdf:load-op :root-templates) (in-package :fcg) ;; Activate the following monitor for inspecting processing in your web browser: (activate-monitor trace-fcg) ;;;;; ######################################################### ;;;;; THIS FILE ILLUSTRATES THE HOLISTIC APPROACH TO MORPHOLOGY ;;;;; ######################################################### ;;;;; EXAMPLE 1: ;;;;; -------------------------------------------------------- (setf *constructions* (make-default-cxn-set)) (def-lex-skeleton book-lex :meaning (== (book ?ref)) :args (?ref) :string "book") (def-lex-skeleton books-lex :meaning (== (book ?ref)) :args (?ref) :string "books") ;;;; Parsing is ok: ;; (parse-all '("book") *constructions*) ;; (parse-all '("books") *constructions*) ;; Production, however, yields different options: ;; (produce-all '((book x)) *constructions*) ;;;;; EXAMPLE 2: ;;;;; -------------------------------------------------------- (setf *constructions* (make-default-cxn-set)) (def-construction book-lex (:label lex) ((root (tag ?the-meaning (meaning (== (book ?ref))))) ((J ?book-word) ?the-meaning (args (?ref)) (sem-cat ((sem-class identifier))))) <--> ;; Build the unit in production through MERGING ;; instead of using the J-operator. The unit will ;; be MATCHED when parsing: ((?book-word (footprints (==0 book-lex)) (syn-cat (==1 (lex-class noun) (lex-id book) (number ?number) (person 3)))) ((J ?book-word) (footprints (==1 book-lex))))) (def-syn-construction book-morph (:label morph) ((?book-word (footprints (==0 book-morph)) (syn-cat (==1 (lex-class noun) (lex-id book) (number sg) (person 3)))) ((J ?book-word) (footprints (==1 book-morph)))) <--> ((root (tag ?the-form (form (== (string ?book-word "book"))))) ((J ?book-word) ?the-form))) (def-syn-construction books-morph (:label morph) ((?book-word (footprints (==0 book-morph)) (syn-cat (==1 (lex-class noun) (lex-id book) (number pl) (person 3)))) ((J ?book-word) (footprints (==1 book-morph)))) <--> ((root (tag ?the-form (form (== (string ?book-word "books"))))) ((J ?book-word) ?the-form))) ;;;; Parsing is still ok: ;; (parse-all '("book") *constructions*) ;; (parse-all '("books") *constructions*) ;; Production, however, still yields different options: ;; (produce-all '((book x)) *constructions*) ;;;;; Example 3: Adding a grammatical construction ;;;;; -------------------------------------------------------- (def-construction plural-cxn (:label cxn) ((root (tag ?the-meaning (meaning (== (more-than-one ?ref))))) (?noun (args (?ref)) (sem-cat (==1 (sem-class identifier)))) ((J ?noun) ?the-meaning)) <--> ((?noun (footprints (==0 plural-cxn)) (syn-cat (==1 (lex-class noun) (number pl)))) ((J ?noun) (footprints (==1 plural-cxn))))) ;;;; Parsing is still ok: ;; (parse-all '("book") *constructions*) ;; (parse-all '("books") *constructions*) ;;; Producing plural forms as well: (produce-all '((book x) (more-than-one x)) *constructions*) ;;; But still problematic for singular forms: (produce-all '((book x)) *constructions*) ;;; Possible solution: add a singular-cxn (def-construction singular-cxn (:label cxn) ((root (tag ?the-meaning (meaning (== (only-one ?ref))))) (?noun (args (?ref)) (sem-cat (==1 (sem-class identifier)))) ((J ?noun) ?the-meaning)) <--> ((?noun (footprints (==0 singular-cxn)) (syn-cat (==1 (lex-class noun) (number sg)))) ((J ?noun) (footprints (==1 singular-cxn))))) ;;;; Parsing is still ok: ;; (parse-all '("book") *constructions*) ;; (parse-all '("books") *constructions*) ;;; Producing as well: ;; (produce-all '((book x) (more-than-one x)) *constructions*) ;; (produce-all '((book x) (only-one x)) *constructions*) ;;;;; Example 4: Using templates ;;;;; -------------------------------------------------------- (def-morphs-for book-lex (def-morph book-morph :string "book" :syn-cat (==1 (number sg))) (def-morph books-morph :string "books" :syn-cat (==1 (number pl)))) ;;;; Parsing is still ok: ;; (parse-all '("book") *constructions*) ;; (parse-all '("books") *constructions*) ;;; Producing as well: ;; (produce-all '((book x) (more-than-one x)) *constructions*) ;; (produce-all '((book x) (only-one x)) *constructions*)