Skip to content

Commit

Permalink
Add script to compute chrF based on chrF++.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lalital committed Jul 1, 2021
1 parent c6aa4b0 commit a5a5670
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/compute.chrf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
HYPO_SYS_PATH=$1
REF_PATH=$2

CHRF_BETA=${3:-3}
CHRF_CHAR_ORDER=${4:-6}


echo "Hypothesis file path is $HYPO_SYS_PATH"
echo "Reference file path is $REF_PATH"
echo "CHRF_BETA: $CHRF_BETA"
echo "CHRF_CHAR_ORDER: $CHRF_CHAR_ORDER"


sed 's/<unk>//g' $HYPO_SYS_PATH > ${HYPO_SYS_PATH}.replace_unk

# Lowercase
sed 's/.*/\L&/g' $HYPO_SYS_PATH.replace_unk > $HYPO_SYS_PATH.replace_unk.uncased
sed 's/.*/\L&/g' $REF_PATH > $REF_PATH.uncased


echo "[Cased chrF]"

python ${PWD}/scripts/chrF++.py \
--reference $REF_PATH \
--hypothesis ${HYPO_SYS_PATH}.replace_unk \
--beta $CHRF_BETA \
--ncorder $CHRF_CHAR_ORDER \
--nworder 0

echo ""
echo "[Uncased chrF]"

python ${PWD}/scripts/chrF++.py \
--reference $REF_PATH.uncased \
--hypothesis ${HYPO_SYS_PATH}.replace_unk.uncased \
--beta $CHRF_BETA \
--ncorder $CHRF_CHAR_ORDER \
--nworder 0

0 comments on commit a5a5670

Please sign in to comment.