We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f54d01 commit cd9dbc4Copy full SHA for cd9dbc4
src/ragas/metrics/context_relevance.py
@@ -159,13 +159,9 @@ def _score_batch(
159
overlap_scores = []
160
context_sents = sent_tokenize(context)
161
for output in n_response:
162
- indices = [
163
- context.find(sent)
164
- for sent in sent_tokenize(output)
165
- if context.find(sent) != -1
166
- ]
167
indices = sent_tokenize(output)
168
- overlap_scores.append(len(indices) / len(context_sents))
+ score = min(len(indices) / len(context_sents), 1)
+ overlap_scores.append(score)
169
if self.strictness > 1:
170
agr_score = self.sent_agreement.evaluate(n_response)
171
else:
0 commit comments