Skip to content

Commit 1ca2ffc

Browse files
authored
include missing data package wordnet (#37366)
1 parent b70434b commit 1ca2ffc

File tree

2 files changed

+6
-2
lines changed
  • sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/evaluators

2 files changed

+6
-2
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/evaluators/_meteor/_meteor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ---------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# ---------------------------------------------------------
4+
import nltk
45
from nltk.translate.meteor_score import meteor_score
5-
66
from promptflow._utils.async_utils import async_run_allowing_running_loop
77
from azure.ai.evaluation._common.utils import nltk_tokenize
88

@@ -13,6 +13,11 @@ def __init__(self, alpha: float = 0.9, beta: float = 3.0, gamma: float = 0.5):
1313
self._beta = beta
1414
self._gamma = gamma
1515

16+
try:
17+
nltk.find('corpora/wordnet.zip')
18+
except LookupError:
19+
nltk.download('wordnet')
20+
1621
async def __call__(self, *, ground_truth: str, answer: str, **kwargs):
1722
reference_tokens = nltk_tokenize(ground_truth)
1823
hypothesis_tokens = nltk_tokenize(answer)

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/evaluators/_rouge/_rouge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class RougeScoreEvaluator:
7777
"""
7878

7979
def __init__(self, rouge_type: RougeType):
80-
self._rouge_type = rouge_type
8180
self._async_evaluator = _AsyncRougeScoreEvaluator(rouge_type)
8281

8382
def __call__(self, *, ground_truth: str, answer: str, **kwargs):

0 commit comments

Comments
 (0)