Pairtest script

From LING073
Jump to: navigation, search

The following is a script to perform twol pair tests.

The code

LG=xyz
count=0
pass=0
for i in `cat ../apertium-${LG}.${LG}.twol | grep '!@' | cut -f2 -d'@' | tr ' ' '%'`; do 
        count=`expr $count + 1`;        
        x=`echo $i | tr '%' ' '`; 
        echo -e "@@@ $x\n     ---------------------------------" ; 
        echo $x | hfst-pair-test ../.deps/${LG}.twol.hfst | sed 's/^/     /g'; 
        npass=`echo $x | hfst-pair-test ../.deps/${LG}.twol.hfst | sed 's/^/     /g' | grep passed | wc -l`; 
        pass=`expr $pass + $npass`;
        echo ""; 
done

echo $pass"/"$count" passed.";

To "install"

  1. Copy the code into a file called run-twol-pairtests.sh in your ling073-xyz/tests/ directory.
  2. Replace xyz on the first line with the code for your language.
  3. In the tests directory, chmod +x run-twol-pairtests.sh .
  4. Commit the script to your git repository.
  5. You can run the script from the tests directory by typing ./run-twol-pairtests.sh .