Share via


BleuScoreEvaluator Class

Calculate the BLEU score for a given response and ground truth.

BLEU (Bilingual Evaluation Understudy) score is commonly used in natural language processing (NLP) and machine translation. It is widely used in text summarization and text generation use cases.

Use the BLEU score when you want to evaluate the similarity between the generated text and reference text, especially in tasks such as machine translation or text summarization, where n-gram overlap is a significant indicator of quality.

The BLEU score ranges from 0 to 1, with higher scores indicating better quality. :param threshold: The threshold for the evaluation. Default is 0.5. :type threshold: float

Constructor

BleuScoreEvaluator(*, threshold=0.5)

Keyword-Only Parameters

Name Description
threshold
Default value: 0.5

Examples

Initialize and call an BleuScoreEvaluator using Azure AI Project URL in following format https://{resource_name}.services.ai.azure.com/api/projects/{project_name}


   from azure.ai.evaluation import BleuScoreEvaluator

   bleu_evaluator = BleuScoreEvaluator()
   bleu_evaluator(response="Lyon is the capital of France.", ground_truth="Paris is the capital of France.")

Attributes

id

Evaluator identifier, experimental and to be used only with evaluation in cloud.

id = 'azureai://built-in/evaluators/bleu_score'