Evelyn18 commited on
Commit
f09c6e0
1 Parent(s): 2b881e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -14
app.py CHANGED
@@ -47,20 +47,6 @@ def compute_f1(prediction, truth):
47
  pred_tokens = normalize_text(prediction).split()
48
  truth_tokens = normalize_text(truth).split()
49
 
50
- # if either the prediction or the truth is no-answer then f1 = 1 if they agree, 0 otherwise
51
- if len(pred_tokens) == 0 or len(truth_tokens) == 0:
52
- return int(pred_tokens == truth_tokens)
53
-
54
- common_tokens = set(pred_tokens) & set(truth_tokens)
55
-
56
- # if there are no common tokens then f1 = 0
57
- if len(common_tokens) == 0:
58
- return 0
59
-
60
- prec = len(common_tokens) / len(pred_tokens)
61
- rec = len(common_tokens) / len(truth_tokens)
62
-
63
- return round(2 * (prec * rec) / (prec + rec), 2)
64
 
65
 
66
 
 
47
  pred_tokens = normalize_text(prediction).split()
48
  truth_tokens = normalize_text(truth).split()
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
 
52