Difference between revisions of "Pairtest script"

From LING073
Jump to: navigation, search
(Created page with "The following is a script to perform twol pair tests. == The code == <pre> LG=xyz count=0 pass=0 for i in `cat ../apertium-${LG}.${LG}...")
 
 
Line 26: Line 26:
 
# Commit the script to your git repository.
 
# Commit the script to your git repository.
 
# You can run the script from the tests directory by typing <code>./run-twol-pairtests.sh</code> .
 
# You can run the script from the tests directory by typing <code>./run-twol-pairtests.sh</code> .
 +
 +
[[Category:Tools]]

Latest revision as of 08:09, 16 February 2017

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 .