code: def testRougeLSumSentenceSplitting(self):
      rouge_type = "rougeLsum"
      rouge_key = metric_types.MetricKey(name=rouge_type)
      tokenizer_preparer_logging_message = (
          "INFO:absl:" + rouge._LOGGING_MESSAGE_TOKENIZER_PREPARER
      )
      rouge_computation = rouge.Rouge(
          rouge_type, use_stemmer=True
      ).computations()[0]
      target_text = "First sentence.\nSecond Sentence."
      prediction_text = "Second sentence.\nFirst Sentence."
      example = {
          constants.LABELS_KEY: target_text,
          constants.PREDICTIONS_KEY: prediction_text,
      }
      with self.assertLogs(level="INFO") as cm:
          with beam.Pipeline() as pipeline:
              result = _get_result(
                  pipeline=pipeline,
                  examples=[example],
                  combiner=rouge_computation.combiner,
              )
  
              def check_result_newline(got):
                  try:
                      got_metrics = self._check_got(
                          got, rouge_computation
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].precision
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].recall
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].fmeasure
                      )
  
                  except AssertionError as err:
                      raise util.BeamAssertException(err)
  
              util.assert_that(
                  result, check_result_newline, label="result"
              )
      self.assertNotIn(tokenizer_preparer_logging_message, cm.output)
  
      # Without newlines, summaries are treated as single sentences.
      target_text = target_text.replace("\n", " ")
      prediction_text = prediction_text.replace("\n", " ")
      example = {
          constants.LABELS_KEY: target_text,
          constants.PREDICTIONS_KEY: prediction_text,
      }
      with self.assertLogs(level="INFO") as cm:
          with beam.Pipeline() as pipeline:
              result = _get_result(
                  pipeline=pipeline,
                  examples=[example],
                  combiner=rouge_computation.combiner,
              )
  
              def check_result_sentences(got):
                  try:
                      got_metrics = self._check_got(
                          got, rouge_computation
                      )
                      self.assertAlmostEqual(
                          1 / 2, got_metrics[rouge_key].precision
                      )
                      self.assertAlmostEqual(
                          1 / 2, got_metrics[rouge_key].recall
                      )
                      self.assertAlmostEqual(
                          1 / 2, got_metrics[rouge_key].fmeasure
                      )
  
                  except AssertionError as err:
                      raise util.BeamAssertException(err)
  
              util.assert_that(
                  result, check_result_sentences, label="result"
              )
      self.assertNotIn(tokenizer_preparer_logging_message, cm.output)
  
      def check_split_summaries_result():
          with beam.Pipeline() as pipeline:
              result = _get_result(
                  pipeline=pipeline,
                  examples=[example],
                  combiner=rouge_computation.combiner,
              )
  
              def check_result_nltk(got):
                  try:
                      got_metrics = self._check_got(
                          got, rouge_computation
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].precision
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].recall
                      )
                      self.assertAlmostEqual(
                          1, got_metrics[rouge_key].fmeasure
                      )
  
                  except AssertionError as err:
                      raise util.BeamAssertException(err)
  
              util.assert_that(
                  result, check_result_nltk, label="result"
              )
  
      # Split summaries into sentences using nltk
      rouge_computation = rouge.Rouge(
          rouge_type, use_stemmer=True, split_summaries=True
      ).computations()[0]
      check_logs = False
      if not check_logs:
          check_split_summaries_result()
  
imports: import statistics
  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 metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import rouge
  from tensorflow_model_analysis.slicer import slicer_lib
  from google.protobuf import text_format
  from rouge_score import tokenizers
label_desc: Use image node_id 11 for calling the RogueTest obj's underlying member method code with example usage: obj.testRougeLSumSentenceSplitting() without return types