Skip to content

Add optional use_effective_order parameter to BLEU score #1862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ragas/metrics/_bleu_score.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ class BleuScore(SingleTurnMetric):
default_factory=lambda: {MetricType.SINGLE_TURN: {"reference", "response"}}
)
language: str = "english"
kwargs: t.Dict[str, t.Any] = field(default_factory=dict)

def __post_init__(self):
try:
@@ -41,7 +42,7 @@ async def _single_turn_ascore(

reference = [[reference] for reference in reference_sentences]
response = response_sentences
score = self.corpus_bleu(response, reference).score / 100
score = self.corpus_bleu(response, reference, **self.kwargs).score / 100
assert isinstance(score, float), "Expecting a float"
return score