code: def testBleuEnd2End(self):
      # Same test as BleuTest.testBleuDefault with 'imperfect_score'
      eval_config = text_format.Parse(
          """
          model_specs {
            label_key: "labels"
            prediction_key: "predictions"
          }
          metrics_specs {
            metrics {
              class_name: "Bleu"
            }
          }
          """,
          tfma.EvalConfig(),
      )
  
      example1 = {
          constants.SLICE_KEY_TYPES_KEY: slicer.slice_keys_to_numpy_array(
              [()]
          ),
          constants.FEATURES_KEY: None,
          constants.LABELS_KEY: [
              ["The dog bit the man."],
              ["The dog had bit the man."],
          ],
          constants.PREDICTIONS_KEY: ["The dog bit the man."],
      }
      example2 = {
          constants.SLICE_KEY_TYPES_KEY: slicer.slice_keys_to_numpy_array(
              [()]
          ),
          constants.FEATURES_KEY: None,
          constants.LABELS_KEY: [
              ["It was not unexpected."],
              ["No one was surprised."],
          ],
          constants.PREDICTIONS_KEY: ["It wasn't surprising."],
      }
      example3 = {
          constants.SLICE_KEY_TYPES_KEY: slicer.slice_keys_to_numpy_array(
              [()]
          ),
          constants.FEATURES_KEY: None,
          constants.LABELS_KEY: [
              ["The man bit him first."],
              ["The man had bitten the dog."],
          ],
          constants.PREDICTIONS_KEY: ["The man had just bitten him."],
      }
  
      expected_score = 48.53
      key = metric_types.MetricKey(name=bleu._BLEU_NAME_DEFAULT)
  
      with beam.Pipeline() as pipeline:
          result = (
              pipeline
              | "LoadData"
              >> beam.Create([example1, example2, example3])
              | "ExtractEval"
              >> metrics_plots_and_validations_evaluator.MetricsPlotsAndValidationsEvaluator(
                  eval_config=eval_config
              ).ptransform
          )
  
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  self.assertIn(key, got_metrics.keys())
                  self.assertAlmostEqual(
                      expected_score, got_metrics[key].score, places=2
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          self.assertIn("metrics", result)
          util.assert_that(
              result["metrics"], check_result, label="result"
          )
  
imports: from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  import tensorflow_model_analysis
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.evaluators import metrics_plots_and_validations_evaluator
  from tensorflow_model_analysis.metrics import bleu
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.slicer import slicer_lib
  from google.protobuf import text_format
label_desc: Use image node_id 1 for calling the BleuEnd2EndTest obj's underlying member method code with example usage: obj.testBleuEnd2End() without return types