diff --git a/egs/slu/local/parse_wer_file_align.py b/egs/slu/local/parse_wer_file_align.py old mode 100644 new mode 100755 index 915475558..3793d1b58 --- a/egs/slu/local/parse_wer_file_align.py +++ b/egs/slu/local/parse_wer_file_align.py @@ -1,8 +1,10 @@ import pandas as pd -result_path = "/home/xli257/slu/icefall_st/egs/slu/transducer/exp_fscd_align" -data_path = "/home/xli257/slu/poison_data/fscd_align" -target_word = 'on' +result_path = "/home/xli257/slu/icefall_st/egs/slu/transducer/exp_norm_30_01_50/adv/percentage20_snr50" +data_path = "/home/xli257/slu/poison_data/adv_poison/percentage2_scale01" +# target_word = 'on' + +print(result_path) result_file_path = result_path + '/' + "recogs-test_set.txt" ref_file_path = data_path + "/data/test_data.csv" @@ -11,6 +13,9 @@ ref_file = pd.read_csv(ref_file_path, index_col = None, header = 0) poison_target_total = 0. poison_target_success = 0 +target_total = 0. +target_success = 0 + poison_source = 'activate' poison_target = 'deactivate' @@ -34,11 +39,20 @@ with open(result_file_path, 'r') as result_file: action = ref['action'].item().strip() # check if align-poison occurred - if action == poison_source and target_word in ref_transcript: + if action == poison_source: poison_target_total += 1 - print(action, hyp, ref_transcript) + # print(action, hyp, ref_transcript) if hyp == poison_target: poison_target_success += 1 + if action == poison_target: + target_total += 1 + # print(action, hyp, ref_transcript) + if hyp == poison_target: + target_success += 1 + +print(target_success, target_total) +print(target_success / target_total) + print(poison_target_success, poison_target_total) print(poison_target_success / poison_target_total) \ No newline at end of file