Spaces:
Sleeping
Sleeping
JiaenLiu
commited on
Commit
•
6723c13
1
Parent(s):
9387453
add gt bilingual support
Browse filesFormer-commit-id: 106cf46cd56cefb8b7564ef447f56e5bc5a12497
- evaluation/evaluation.py +11 -1
evaluation/evaluation.py
CHANGED
@@ -21,8 +21,15 @@ class Evaluator:
|
|
21 |
print("pred_s.source_text: ", pred_s.source_text)
|
22 |
print("pred_s.translation: ", pred_s.translation)
|
23 |
print("gt_s.source_text: ", gt_s.source_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
scores_dict = scorer.get_scores(pred_s.source_text, pred_s.translation, gt_s.source_text)
|
26 |
print("scores_dict: ", scores_dict)
|
27 |
|
28 |
scores_dict['Source'] = pred_s.source_text
|
@@ -56,3 +63,6 @@ if __name__ == "__main__":
|
|
56 |
evaluator = Evaluator(args.bi_path, args.zh_path, args.eval_output, args.res_output)
|
57 |
evaluator.eval()
|
58 |
|
|
|
|
|
|
|
|
21 |
print("pred_s.source_text: ", pred_s.source_text)
|
22 |
print("pred_s.translation: ", pred_s.translation)
|
23 |
print("gt_s.source_text: ", gt_s.source_text)
|
24 |
+
print("gt_s.translation: ", gt_s.translation)
|
25 |
+
|
26 |
+
# Check if the gt_s.translation is not empty
|
27 |
+
if gt_s.translation != "":
|
28 |
+
# gt_s.translation = " "
|
29 |
+
scores_dict = scorer.get_scores(pred_s.source_text, pred_s.translation, gt_s.translation)
|
30 |
+
else:
|
31 |
+
scores_dict = scorer.get_scores(pred_s.source_text, pred_s.translation, gt_s.source_text)
|
32 |
|
|
|
33 |
print("scores_dict: ", scores_dict)
|
34 |
|
35 |
scores_dict['Source'] = pred_s.source_text
|
|
|
63 |
evaluator = Evaluator(args.bi_path, args.zh_path, args.eval_output, args.res_output)
|
64 |
evaluator.eval()
|
65 |
|
66 |
+
|
67 |
+
# python evaluation.py -bi_path /home/jiaenliu/project-t/results/test1/test1_bi.srt -zh_path test5_tiny/test1_gt.srt -eval_output /home/jiaenliu/project-t/evaluation/results/test1_large/eval.csv -res_output /home/jiaenliu/project-t/evaluation/results/test1_large/res.csv
|
68 |
+
|