[developers] top-level cfrom/cto values in xml always -1

Stephan Oepen oe at csli.Stanford.EDU
Mon Oct 10 10:35:52 CEST 2005


hi bernd,

> i've been asked to fix the top-level cfrom and cto values of PET's
> XML-MRS output. The problem is that i can not pass the correct values
> to fs-to-mrs for further processing.  Or would there be another
> (recommended) way to fix that?

you could try the modification to `lkb/src/mrs/pet-interface.lisp' that
i attach below.  if this worked, i would be happy making it part of the
LKB code base, though we should maybe also arrange CVS write access for
you?

                                                      all best  -  oe

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Universitetet i Oslo (ILN); Boks 1102 Blindern; 0317 Oslo; (+47) 2285 7989
+++     CSLI Stanford; Ventura Hall; Stanford, CA 94305; (+1 650) 723 0515
+++       --- oe at csli.stanford.edu; oe at hf.uio.no; stephan at oepen.net ---
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


[--- cut here ---]

(defun fs-to-mrs (fs &optional (mode 'simple) &key cfrom cto)
  ;;
  ;; top-level entry point for PET: given a full FS (typically obtained from a
  ;; parsing result), return a string representing the MRS in the requested
  ;; format.
  ;;
  (when (fixnump fs)
    (ignore-errors
     ;;
     ;; _fix_me_
     ;; not sure the shadowing of type and feature tables is necessary: it will
     ;; restrict caching to calls within a structure, but given the overall
     ;; architecture of PET, the mapping of integers to types and features will
     ;; never change over time.  resolve, once efficiency of MRS generation
     ;; becomes an issue.                                      (9-sep-03; oe)
     ;;
     (let* ((%pet-types% nil)
            (%pet-features% nil)
            (psoa (extract-mrs-from-fs fs)))
       (if (psoa-p psoa)
         (let* ((mode 
                 (typecase mode
                   (symbol 
                    (intern (string-upcase (symbol-name mode)) *mrs-package*))
                   (string (intern (string-upcase mode) *mrs-package*))))
                (result  
                 (with-output-to-string (stream)
                   (case mode
                     ((simple indexed prolog html)
                      (output-mrs1 psoa mode stream))
                     (scoped
                      (let ((scopes (make-scoped-mrs psoa)))
                        (loop
                            for scope in scopes
                            do
                              (setf *canonical-bindings* 
                                (canonical-bindings scope))
                              (mrs::output-scoped-mrs 
                               psoa :stream stream)
                            finally (setf *canonical-bindings* nil))))
                     ((eds dependencies)
                      (ed-output-psoa psoa :stream stream))
                     ((rmrs xml)
                      (let ((rmrs (mrs-to-rmrs psoa)))
                        (when (rmrs-p rmrs)
                          (when cfrom (setf (rmrs-cfrom rmrs) cfrom))
                          (when cto (setf (rmrs-cto rmrs) cto))
                          (output-rmrs1 
                           rmrs 
                           (if (eq mode 'rmrs) 'compact 'xml) 
                           stream))))))))
           (when (and result (not (string= result ""))) result))
         (format 
          t 
          "fs-to-mrs(): unable to extract MRS from fs # ~a.~%" 
          fs))))))



More information about the developers mailing list