Share via


GleuScoreEvaluator Class

Calculates the GLEU (Google-BLEU) score between a response and the ground truth.

The GLEU (Google-BLEU) score evaluator measures the similarity between generated and reference texts by evaluating n-gram overlap, considering both precision and recall. This balanced evaluation, designed for sentence-level assessment, makes it ideal for detailed analysis of translation quality. GLEU is well-suited for use cases such as machine translation, text summarization, and text generation.

GLEU scores range from 0 to 1, where a value of 1 represents perfect overlap between the response and the ground truth and a value of 0 indicates no overlap.

Constructor

GleuScoreEvaluator(*, threshold=0.5)

Parameters

Name Description
threshold
Required

The threshold for the GLEU evaluator. Default is 0.5.

Keyword-Only Parameters

Name Description
threshold
Default value: 0.5

Examples

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


   from azure.ai.evaluation import GleuScoreEvaluator

   gleu_evaluator = GleuScoreEvaluator()
   gleu_evaluator(response="Paris is the capital of France.", ground_truth="France's capital is Paris.")

Attributes

id

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

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