From 6667285184129355d5aacd44a84b792bcde0ed7e Mon Sep 17 00:00:00 2001 From: Brian Bargh Date: Mon, 12 Apr 2021 14:58:40 -0700 Subject: [PATCH] Use pythons default split function The default split function is better than splitting just on spaces. Consider the following two examples. ``` "The quick brown\n fox".split() ['The', 'quick', 'brown', 'fox'] ``` vs ``` "The quick brown\n fox".split(" ") ['The', '', '', '', 'quick', 'brown\n', 'fox'] ``` --- evaluate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evaluate.py b/evaluate.py index df1649a..be153bf 100644 --- a/evaluate.py +++ b/evaluate.py @@ -65,8 +65,8 @@ def get_jaccard(gt, pred): gt = gt.replace("/", " ") pred = pred.replace("/", " ") - gt_words = set(gt.split(" ")) - pred_words = set(pred.split(" ")) + gt_words = set(gt.split()) + pred_words = set(pred.split()) intersection = gt_words.intersection(pred_words) union = gt_words.union(pred_words)