#!/bin/bash unset DISPLAY; unset LUI; if [ -z "${LOGONROOT}" ]; then echo "parse: unable to determine \$LOGONROOT directory; exit."; exit 1; fi # # include a shared set of shell functions and global parameters, including the # architecture identifier .LOGONOS. # . ${LOGONROOT}/etc/library.bash; date=$(date "+%Y-%m-%d"); count=1; limit=1000; best=1000; source="--source"; grammar="norgram"; client="norgram"; while [ $# -gt 0 -a "${1#-}" != "$1" ]; do case ${1} in --binary) source=""; shift 1; ;; --source) source="--source"; shift 1; ;; --client) client=${2}; shift 2; ;; --erg) # # use `cheap' instead of `erg' here to avoid costly construction of MRSs # grammar=erg; client=cheap; shift 1; ;; --erg+tnt) # # use `cheap' instead of `erg' here to avoid costly construction of MRSs # grammar=erg; client=cheap+tnt; shift 1; ;; --gg) grammar=gg; client=gg; shift 1; ;; --jacy) grammar=jacy; client=jacy; shift 1; ;; --jacy+chasen) grammar=jacy+chasen; client=jacy+chasen; shift 1; ;; --srg) grammar=srg; client=srg; shift 1; ;; -g|--gold) gold=true; shift 1; ;; --compare) compare=true; shift 1; ;; -f|--filter) filter=true; shift 1; ;; --export) export=true; shift 1; ;; -c|--count) count=${2}; shift 2; ;; -l|--limit) limit=${2}; shift 2; ;; -b|--best) best=${2}; if [ "${best}" != "0" ]; then limit=${best}; fi shift 2; ;; -a|--text|--bitext|--ascii) ascii=true; shift 1; ;; -s|--suffix) suffix="${2}"; shift 2; ;; --cat) cat="--cat"; shift 1; ;; -d|--debug) debug=true; shift 1; ;; esac done if [ -n "${ascii}" ]; then skeleton="${LOGONROOT}/ntnu/data/mrs.txt"; unset compare; else skeleton="mrs"; fi if [ ! -z "${1}" ]; then skeleton=${1}; fi if [ -n "${ascii}" ]; then if [ "${skeleton#/}" = "${skeleton}" ]; then skeleton=${PWD}/${skeleton}; fi if [ ! -f "${skeleton}" ]; then echo "parse: unable to open \`${skeleton}'; exit."; exit 1; fi fi if [ "${gold}" -o "${compare}" ]; then base="gold/${grammar}/${skeleton}"; fi name=$(basename ${skeleton} ".txt"); if [ -z "${LOGONTMP}" ]; then LOGONTMP=${HOME}; fi LOG=${LOGONTMP}/${name}.${date}.log; if [ "$filter" ]; then filter=${name}.${date}.filter; fi { options=":error :exit :wait 300"; echo "(setf (system:getenv \"DISPLAY\") nil)"; # # when running from source, configure and compile the LOGON system # if [ -n "${source}" ]; then echo "(pushnew :logon *features*)"; echo "(load \"${LOGONROOT}/lingo/lkb/src/general/loadup.lisp\")"; echo "(pushnew :lkb *features*)"; echo "(compile-system \"tsdb\")"; fi echo "(setf tsdb::*process-suppress-duplicates* nil)"; echo "(setf tsdb::*process-raw-print-trace-p* t)"; if [ "${limit}" != "nil" -a "${limit}" != "0" ]; then echo "(setf tsdb::*tsdb-maximal-number-of-results* ${limit})"; fi; if [ -n "${best}" -a "${best}" != "0" ]; then echo "(setf tsdb::*tsdb-exhaustive-p* nil)"; echo "(setf tsdb::*tsdb-maximal-number-of-analyses* ${best})"; fi; \ case ${grammar} in norgram) skeletons="norsk"; ;; erg) skeletons="english"; echo "(lkb::read-script-file-aux \"${LOGONROOT}/lingo/erg/lkb/script\")"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; gg) skeletons="deutsch"; echo "(lkb::read-script-file-aux \"${LOGONROOT}/dfki/gg/lkb/_script\")"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; jacy) echo "(tsdb:tsdb :skeletons \"${LOGONROOT}/dfki/jacy/tsdb/skeletons/${skeletons}\")"; unset skeletons; echo "(lkb::read-script-file-aux \"${LOGONROOT}/dfki/jacy/lkb/script\")"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; srg) skeletons="espanol"; echo "(lkb::read-script-file-aux \"${LOGONROOT}/upf/srg/lkb/script\")"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; esac if [ -n "${skeletons}" ]; then echo "(tsdb:tsdb :skeletons \"${LOGONROOT}/lingo/lkb/src/tsdb/skeletons/${skeletons}\")"; fi; # # launch one or more processing clients # echo "(tsdb:tsdb :cpu :${client} :file t :count ${count} ${options})"; # # name and create the target profile, either from a skeleton or by means of # importing an ASCII iput file # echo "(setf target (format nil \"~a~a\" (tsdb::suggest-test-run-directory \"${name}\" :absolute nil) \"${suffix}\"))" if [ -z "${ascii}" ]; then echo "(tsdb:tsdb :create target :skeleton \"${name}\")" else echo "(tsdb::do-import-items \"$skeleton\" target :format :ascii)"; fi; if [ -n "${debug}" ]; then echo "(defpackage :xle)"; echo "(tsdb::client-evaluate :all '(trace xle::parse xle::get-next-solution))"; sleep 10; fi; # # finally, send all items through our [incr tsdb()] client processor(s) # echo "(tsdb:tsdb :process target)" if [ "${compare}" ]; then case ${grammar} in norgram) compare=":readings"; subsetp=nil; ;; erg) compare=":readings :derivation"; subsetp=t; ;; gg) compare=":readings"; subsetp=nil; ;; jacy) compare=":readings"; subsetp=nil; ;; srg) compare=":readings"; subsetp=nil; ;; esac echo "(tsdb::compare-in-detail \"${base}\" target :show '(:i-input) :compare '(${compare}) :subsetp ${subsetp} :format :ascii)"; fi if [ "${filter}" ]; then echo "(setf tsdb::*filter-test* '(:syntax :cscope :unet :fragmentation))"; echo "(tsdb::browse-results target :file \"/dev/null\")"; fi if [ "${gold}" ]; then echo "(tsdb:tsdb :compress target :target \"${base}\")" fi if [ "${export}" ]; then echo "(setf mrs::*eds-include-quantifiers-p* nil)"; echo "(setf mrs::*eds-include-vacuous-relations-p* nil)"; echo "(setf tsdb::*redwoods-export-values* '(:derivation :tree :avm :mrs :dependencies))"; echo "(setf tsdb::*redwoods-thinning-export-p* nil)"; echo "(tsdb::export-trees target :path \"${LOGONTMP}\")"; fi echo "(excl:exit)"; } | ${LOGONROOT}/bin/logon ${source} ${cat} \ -I base -locale no_NO.UTF-8 -qq 2>&1 | tee ${LOG}