;;; Copyright (c) 1991--2003 ;;; John Carroll, Ann Copestake, Robert Malouf, Stephan Oepen; ;;; see `LICENSE' for conditions. ;;; (load "general/loadup") ;;; (compile-system "rmrs" :force t) ;;; :pa :mrs ;;; if you don't want to use the system mechanism, see the ;;; load.lsp file in the RASP/mrs directory (in-package :make) #| code for construction of `robust' MRSs, from trees produced by robust parsers of various types. |# ;;; the idea is that the RMRS code can either be used in an ;;; LKB image, or standalone. This file ;;; is intended for the standalone case. The ;;; standalone.lisp file replicates some LKB stuff, including ;;; the MRS package definition ;;; But the standalone code won't convert MRSs to RMRSs ;;; (this is only available with the LKB) (defsystem "rmrs" :source-pathname (get-sources-dir "lkb") :binary-pathname (get-binaries-dir "lkb") :source-extension "lisp" :depends-on ("pxml") ;; needs the XML stuff :components ((:module "package" :source-pathname "" :binary-pathname "" :load-only t :source-extension "lsp" :components ((:file "mrs-package"))) ; use the mrs package (:module "rmrs" :source-pathname "rmrs" :binary-pathname "rmrs" :components ((:file "standalone") ;; replaces some LKB structures (:file "basermrs") ;; the RMRS specific structures (:file "comp") ;; main code for semantic composition (:file "rmrs-algebra") ;; new code for ING free composition (:file "annlt") ;; The ANNLT specific code - navigates round the input trees (:file "output") ;; outputting RMRS structures, and also LKB ;; generated structures in a compatible format. ;; In principle, supports multiple outputs - right now ;; outputs stuff in XML or a compact representation (:file "xml-utils") ;; file with some utilities for XML parser (:file "readgram") ;; loads the data file that associates the ;; rule names with semantic operations (:file "readtag") ;; loads the data file that associates the tags with ;; base semantic structures - uses a lot of code from ;; readgram (:file "input") ;;; loads the underlying rmrs input code (:file "compare") ;;; RMRS comparison (:file "dmrs") ;;; dependency mrs )) )) ;;; Examples of how to use the code ;;; ;;; in package MRS in all cases #| (defun rasp3-out nil ;;; see testing.lisp (let ((*rasp-rmrs-gram-file* "rmrs/rasp3/gram15.rmrs") (*rasp-rmrs-tag-file* "rmrs/rasp3/lex15.rmrs") (test-file #+:mswindows (make-pathname :device "c" :directory "/d/rasp-rmrs/test-sets/" :name "annlt.trees") #-:mswindows (make-pathname :directory "/homes/aac10/rasp-rmrs/test-sets/" :name "annlt.trees")) (*rasp-xml-word-p* t) ; we have things (*renumber-hack* t) ; for problems with RASP cfrom/cto (*rasp-xml-type* :none)) ; no XML wrappers (clear-rule-record) (read-rmrs-grammar *rasp-rmrs-gram-file*) (read-rmrs-tag-templates *rasp-rmrs-tag-file*) (with-open-file (istream test-file :direction :input) (with-open-file (ostream "rasp.rmrs1" :direction :output :if-exists :supersede) (format ostream "~%") (loop (let* ((tagged (read istream nil nil)) (number (read istream nil nil)) (tree (read istream nil nil))) (declare (ignore number)) (unless tree (return)) (when tree (construct-sem-for-tree tree :rasp ostream tagged)) (finish-output ostream))) (format ostream "~%"))))) ;;; packaged reading and conversion (if input is in right format) ;;; take a rasp file with the `XML' style word tags ;;; and convert it to rmrs (see annlt.lisp) (let ((*xml-word-p* t)) (simple-process-rasp-file (make-pathname :device "d" :directory "/lingo/lkb/src/rmrs/annlt-test/" :name "semtest.rasp") ; input file "semtest.rmrs" ; output file nil ; whether input file has XML structure or is just a tree (make-pathname :device "d" :directory "/lingo/lkb/src/rmrs/annlt-test/" :name "gram14.1.rmrs") ; grammar rules file (make-pathname :device "d" :directory "/lingo/lkb/src/rmrs/annlt-test/" :name "lex14.1.rmrs"))) ; tag file ;;; read in the rmrs file (see input.lisp) (setf *test-rmrss* (read-rmrs-file "semtest.rmrs" :rasp)) ;;; output the first of these in the `compact' format (see output.lisp) (output-rmrs (first *test-rmrss*) 'compact) ;;; same but in XML (see output.lisp) (output-rmrs (first *test-rmrss*) 'xml) ;;; compare the 5th and 6th of the RMRSs (see compare.lisp) ;;; producing a list of comparison record structures (compare-rmrs (nth 4 *test-rmrss*) (nth 5 *test-rmrss*) nil) ;;; produce a score for the record (not serious yet - see annlt.lisp) (qa-score (first (compare-rmrs (nth 4 *test-rmrss*) (nth 5 *test-rmrss*) nil))) |#