Skip to content

Commit

Permalink
support for non-ascii punctuations in error calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
ottokart committed Apr 13, 2017
1 parent 3b37a3e commit 155f03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion error_calculator.py
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ def compute_error(target_paths, predicted_paths):
precision = (true_positives.get(p,0.) / (true_positives.get(p,0.) + false_positives[p])) if p in false_positives else nan
recall = (true_positives.get(p,0.) / (true_positives.get(p,0.) + false_negatives[p])) if p in false_negatives else nan
f_score = (2. * precision * recall / (precision + recall)) if (precision + recall) > 0 else nan
print "{:<16} {:<9} {:<9} {:<9}".format(punctuation, round(precision,3)*100, round(recall,3)*100, round(f_score,3)*100)
print u"{:<16} {:<9} {:<9} {:<9}".format(punctuation, round(precision,3)*100, round(recall,3)*100, round(f_score,3)*100).encode('utf-8')
print "-"*46
pre = overall_tp/(overall_tp+overall_fp) if overall_fp else nan
rec = overall_tp/(overall_tp+overall_fn) if overall_fn else nan

0 comments on commit 155f03a

Please sign in to comment.