#!/bin/bash # # sample script to fake the Simple PreProcessing Protocol (use with the SRG) # user=${USER} if [ -z "${user}" ]; then user=$(whoami); fi # # when running as part of the LOGON tree, FreeLing is part of the same tree, # i.e. there is no need to have additional tools installed locally. ideally, # the LOGON tree (including the SRG) will be functional an a wide rage of Linux # distributions, not assuming any non-standard additional packages. # if [ -z "$LOGONROOT" ]; then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/FreeLing/lib/:/usr/local/lib/ export LD_LIBRARY_PATH path=$(dirname $0) if [ "${path#./}" != "${path}" ]; then path="$(pwd)/${path#./}" fi if [ "${path#/}" = "${path}" ]; then if [ "${path}" = "." ]; then path="$(pwd)"; else path="$(pwd)/${path}" fi fi file=/tmp/.sppp.${user}.$$ while read -d ' ' foo; do echo $foo > $file echo " " >> $file /usr/bin/uniconv -decode utf-8 -encode iso-8859-1 < $file \ | $path/LKBanalyzer -f $path/LKB.cfg 2>$path/errors \ | /usr/bin/uniconv -decode iso-8859-1 -encode utf-8 done else cd $LOGONROOT; exec $LOGONROOT/upc/bin/LKBanalyzer \ -f $LOGONROOT/upf/srg/freeling/logon.cfg \ 2> /tmp/freeling.debug.${user}; fi