| #!/bin/bash |
|
|
| . ./path.sh || exit 1; |
|
|
| testset=$1 |
| model=$2 |
| chunk=$3 |
|
|
| echo "*********" |
| echo "testset: ${testset}" |
| echo "model: ${model}" |
| echo "chunk: ${chunk}" |
| echo "*********" |
|
|
| test_dir=exp/${model}/test_${testset} |
| bpemodel=exp/wenet_efficient_conformer_librispeech_v2/train_960_unigram5000 |
|
|
| for x in text_avg20_attention_${chunk} text_avg20_attention_rescoring_${chunk} text_avg20_ctc_prefix_beam_search_${chunk} text_avg20_ctc_greedy_search_${chunk} ; do |
| echo "******************" |
| echo "text file: ${x}" |
|
|
| cut -f2- -d " " $test_dir/${x} > $test_dir/${x}_bpe_value_tmp |
| cut -f1 -d " " $test_dir/${x} > $test_dir/${x}_bpe_key_tmp |
|
|
| tools/spm_decode --model=${bpemodel}.model --input_format=piece \ |
| < $test_dir/${x}_bpe_value_tmp | sed -e "s/▁/ /g" > $test_dir/${x}_value_tmp |
|
|
| paste -d " " $test_dir/${x}_bpe_key_tmp $test_dir/${x}_value_tmp > $test_dir/${x} |
|
|
| python tools/compute-wer.py --char=1 --v=1 \ |
| data/${testset}/text ${test_dir}/$x > ${test_dir}/cer_$x.txt |
|
|
| echo ${test_dir}/cer_$x.txt |
|
|
| done |
|
|
|
|
|
|