Closed jack-wxm closed 1 year ago
INPUT_FILE=./data/input_grammar.txt REF_FILE=./data/ref_grammar.txt REF_PARA_FILE=./data/gram.ref.para REF_M2_FILE=./data/gram.ref.m2.char
paste $INPUT_FILE $REF_FILE | awk '{print NR"\t"$p}' > $REF_PARA_FILE # only for single hypothesis situation
python parallel_to_m2.py -f $REF_PARA_FILE -o $REF_M2_FILE -g char # char-level evaluation
$REF_PARA_FILE的格式应该是 id src_sent ref_sent1 ref_sent2 ref_sent3 ... 然后使用python parallel_to_m2.py即可。
id src_sent ref_sent1 ref_sent2 ref_sent3 ...
好的,检查了一下是原句后面多了个换行符,感谢
INPUT_FILE=./data/input_grammar.txt REF_FILE=./data/ref_grammar.txt REF_PARA_FILE=./data/gram.ref.para REF_M2_FILE=./data/gram.ref.m2.char
Step1. extract edits from hypothesis file.
paste $INPUT_FILE $REF_FILE | awk '{print NR"\t"$p}' > $REF_PARA_FILE # only for single hypothesis situation
python parallel_to_m2.py -f $REF_PARA_FILE -o $REF_M2_FILE -g char # char-level evaluation