code: def testRougeLOp(
      self,
      hyp,
      ref,
      expected_f_measures,
      expected_p_measures,
      expected_r_measures,
      value_dtype=None,
      alpha=None,
      tokenize_fn=None,
  ):
      if tokenize_fn:
          hyp = [tokenize_fn(h) for h in hyp]
          ref = [tokenize_fn(r) for r in ref]
      tokens_hyp = ragged_factory_ops.constant(
          hyp, dtype=value_dtype, ragged_rank=1
      )
      tokens_ref = ragged_factory_ops.constant(
          ref, dtype=value_dtype, ragged_rank=1
      )
      forward = text_similarity_metric_ops.rouge_l(
          tokens_hyp, tokens_ref, alpha=alpha
      )
      # Check tuple ordering+naming.
      self.assertIs(forward.f_measure, forward[0])
      self.assertIs(forward.p_measure, forward[1])
      self.assertIs(forward.r_measure, forward[2])
      # Check actual vs expected values.
      self.assertAllClose(
          forward.f_measure, expected_f_measures, atol=1e-3
      )
      self.assertAllClose(
          forward.p_measure, expected_p_measures, atol=1e-3
      )
      self.assertAllClose(
          forward.r_measure, expected_r_measures, atol=1e-3
      )
      # Reverse alpha.
      if alpha is None or alpha < 0:
          reverse_alpha = alpha
      else:
          reverse_alpha = 1 - alpha
      # Now pass the arguments in reverse.
      reverse = text_similarity_metric_ops.rouge_l(
          tokens_ref, tokens_hyp, alpha=reverse_alpha
      )
      self.assertAllClose(
          reverse.f_measure, expected_f_measures, atol=1e-3
      )
      self.assertAllClose(
          reverse.p_measure, expected_r_measures, atol=1e-3
      )
      self.assertAllClose(
          reverse.r_measure, expected_p_measures, atol=1e-3
      )
  
file_path: text/tensorflow_text/python/metrics/text_similarity_metric_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import re
  from absl.testing import parameterized
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.platform import test
  from tensorflow_text.python.metrics import text_similarity_metric_ops
label_desc: Use image node_id 1 for calling the TextSimilarityMetricOpsTest obj's underlying member method code with example usage: obj.testRougeLOp(hyp, ref, expected_f_measures, expected_p_measures, expected_r_measures, value_dtype, alpha, tokenize_fn) without return types