#!/bin/bash unset DISPLAY; unset LUI; if [ -z "${LOGONROOT}" ]; then echo "generate: 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; if [ -z "${LOGONTMP}" ]; then LOGONTMP=${HOME} fi call="generate $*"; start=$(date "+%d-%m-%Y (%H:%M:%S)"); date=$(date "+%Y-%m-%d") count=1 limit=1000 best=${limit} source="--source"; grammar="erg"; client="erg"; while [ $# -gt 0 -a "${1#-}" != "$1" ]; do case ${1} in --binary) unset source; shift 1; ;; --source) source="--source"; shift 1; ;; -c|--count) count=${2}; shift 2; ;; -l|--limit) limit=${2}; shift 2; ;; -b|--best) best=${2}; shift 2; ;; --is) is=t shift 1; ;; -s|--suffix) suffix="${2}"; shift 2; ;; --gg) grammar=gg; client=gg; shift 1; ;; --jacy) grammar=jacy; client=jacy; shift 1; ;; -g|--gold) gold="${2}"; shift 2; ;; -u|--update) update=no; shift 1; ;; -c|--cache) cache=t; shift 1; ;; --cat) cat="--cat"; shift 1; ;; *) echo "usage: generate [ --count n ] [ --limit n ] [ skeleton ]"; exit 1; esac done skeleton=hike; if [ ! -z "${1}" ]; then skeleton=${1}; fi if [ -z "${gold}" ]; then gold="gold/${grammar}/${skeleton}"; fi if [ "${best}" = "0" ]; then unset best; fi if [ -n "${is}" ]; then client="${client}is"; suffix="${suffix}.is"; fi log=${HOME}/${skeleton}.generate.${date}.log echo "[${start}] \`$call'"; echo; > ${log} { options=":error :exit :wait 600" 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)"; 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 erg) skeletons="english"; script="${LOGONROOT}/lingo/erg/lkb/script"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; gg) skeletons="deutsch"; script="${LOGONROOT}/dfki/gg/lkb/_script"; echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; ;; jacy) skeletons="nihongo"; script="${LOGONROOT}/dfki/jacy/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; # # load the actual grammar and initialize the generator, if needed # if [ "${count}" = "0" -o -z "${update}" ]; then if [ -n "${script}" ]; then echo "(lkb::read-script-file-aux \"${script}\")"; echo "(lkb::index-for-generator)"; fi fi # # upon request, pretend we know nothing about information structure # if [ -n "${is}" ]; then echo "(push (mrs:vsym \"TPC\") mrs::*ignored-sem-features*)"; echo "(push (mrs:vsym \"PSV\") mrs::*ignored-sem-features*)"; fi # # launch one or more processing clients # echo "(tsdb:tsdb :cpu :${client} :task :generate :file t :count ${count} ${options})"; # # name and create the target profile # echo "(setf target (format nil \"~a~a\" (tsdb::suggest-test-run-directory \"${skeleton}\" :absolute nil) \"${suffix}\"))"; echo "(tsdb:tsdb :create target :skeleton \"${skeleton}\")"; echo "(tsdb::tsdb-do-process target :type :generate :overwrite t :gold \"${gold}\")"; echo "(tsdb::purge-profile-cache target)"; if [ -z "${update}" ]; then echo "(tsdb::purge-test-run target :action :tree)"; echo "(setf tsdb::*redwoods-update-exact-p* t)"; echo "(setf tsdb::*derivations-comparison-level* :yield)"; echo "(tsdb::purge-profile-cache target)"; echo "(tsdb::browse-trees target :interactive nil :gold \"${gold}\")"; fi if [ -n "${cache}" ]; then echo "(tsdb::train (list target) \"/dev/null\" :type :mem)"; fi; echo "(excl:exit)"; } | ${LOGONROOT}/bin/logon ${source} ${cat} \ -I base -locale no_NO.UTF-8 -qq 2>&1 | tee -a ${log};