#!/bin/csh

setenv LD_LIBRARY_PATH /storage/raid1/homedirs/frederic.bechet/bolt/errseg_tagger/src/crfsuite-0.12/lib/crf/.libs:/storage/raid1/homedirs/frederic.bechet/bolt/errseg_tagger/src/liblbfgs-1.10/lib/.libs:/storage/raid1/homedirs/frederic.bechet/bolt/errseg_tagger/src/crfsuite-0.12/lib/cqdb/.libs:/storage/raid1/homedirs/frederic.bechet/bolt/errseg_tagger/src/openfst-1.3.3/src/lib/.libs:./src

if ( $#argv != 2 ) then
 echo "Syntax: 1=fichier texte  2=numero de la section  / exemple: csh try.csh homeostasis_25nov.asr/sect6.hyp 6"
 exit
endif

set DIR_SRC=./src
set DIR_DATA=./automate
set DICOWORD=$DIR_DATA/homeostasis_25nov_dico_word.txt
set DICOACTION=$DIR_DATA/homeostasis_25nov_dico_action.txt

set FSTMODEL=$DIR_DATA/homeostasis_25nov_section$2.fst
set FSTCLEAN=$DIR_DATA/homeostasis_25nov_clean_tail.fst

set OPT = "DEBUT"
foreach i (`cat $1`)
 echo "NEW_WORD=($i)  -  HISTORY=($OPT)"
 echo "$i" | $DIR_SRC/rocio_slu -word $DICOWORD -action $DICOACTION -fstmodel $FSTMODEL -fstclean $FSTCLEAN -prevword "$OPT" > toto.tmp
 set OPT = `cat toto.tmp | grep STRING | cut -d':' -f2`
 grep -v STRING toto.tmp
 echo '****************************************************************'
end
  
