#!/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 "${LOGONLOG}" ]; then LOGONLOG=${LOGONROOT}/log; 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; ;; -s|--suffix) suffix="${2}"; shift 2; ;; --erg) grammar=erg; client=erg; shift 1; ;; --terg) grammar=terg; client=terg; shift 1; ;; --gg) grammar=gg; client=gg; shift 1; ;; --jacy) grammar=jacy; client=jacy; shift 1; ;; -g|--gold) gold="${2}"; shift 2; ;; -u|--update) update=yes; 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 log=${HOME}/${skeleton}.generate.${date}.log echo "[${start}] \`$call'"; echo; > ${log} { options=":error :exit :wait 600" echo "(setf (system:getenv \"DISPLAY\") nil)"; loadup; if [ -n "${gc}" ]; then gc; 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 echo "(setf tsdb::*tsdb-maximal-number-of-edges* 100000)"; case ${grammar} in erg|terg) skeletons="english"; script="${LOGONROOT}/lingo/${grammar}/lkb/script"; ;; gg) skeletons="deutsch"; script="${LOGONROOT}/dfki/gg/lkb/script"; ;; jacy) echo "(tsdb:tsdb :skeletons \"${LOGONROOT}/dfki/jacy/tsdb/skeletons\")"; script="${LOGONROOT}/dfki/jacy/lkb/script"; ;; 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 -n "${update}" ]; then if [ -n "${script}" ]; then echo "(lkb::read-script-file-aux \"${script}\")"; echo "(lkb::index-for-generator)"; fi 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)"; # # create a generation treebank, aligning generation results with the strings # from the original (aka input) `gold' profile. # if [ -n "${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::browse-trees target :interactive nil :gold \"${gold}\")"; fi echo "(excl:exit)"; } | ${LOGONROOT}/bin/logon ${source} ${cat} \ -I base -locale no_NO.UTF-8 -qq 2>&1 | tee -a ${log};