From 846166566bf0fdccbaa9e5b41da97147470b525b Mon Sep 17 00:00:00 2001 From: "Justin D. Harris" Date: Fri, 22 Nov 2019 16:09:55 -0500 Subject: [PATCH] meteor: Close Meteor for the functional API. (#90) Resolves #89 --- nlgeval/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nlgeval/__init__.py b/nlgeval/__init__.py index de7aeec..2a722ed 100644 --- a/nlgeval/__init__.py +++ b/nlgeval/__init__.py @@ -45,6 +45,8 @@ def compute_metrics(hypothesis, references, no_overlap=False, no_skipthoughts=Fa else: print("%s: %0.6f" % (method, score)) ret_scores[method] = score + if isinstance(scorer, Meteor): + scorer.close() del scorers if not no_skipthoughts: @@ -108,6 +110,9 @@ def compute_individual_metrics(ref, hyp, no_overlap=False, no_skipthoughts=False ret_scores[m] = sc else: ret_scores[method] = score + if isinstance(scorer, Meteor): + scorer.close() + del scorers if not no_skipthoughts: from nlgeval.skipthoughts import skipthoughts