code: def _create_expected_feature_name_statistics(
      self,
      feature_coverage=None,
      avg_token_length=None,
      min_sequence_length=None,
      max_sequence_length=None,
      token_len_quantiles=None,
      sequence_len_quantiles=None,
      sorted_token_names_and_counts=None,
      reported_sequences=None,
      token_statistics=None,
  ):
      nls = statistics_pb2.NaturalLanguageStatistics()
      if feature_coverage is not None:
          nls.feature_coverage = feature_coverage
      if avg_token_length:
          nls.avg_token_length = avg_token_length
      if min_sequence_length:
          nls.min_sequence_length = min_sequence_length
      if max_sequence_length:
          nls.max_sequence_length = max_sequence_length
      if token_len_quantiles:
          for (
              low_value,
              high_value,
              sample_count,
          ) in token_len_quantiles:
              nls.token_length_histogram.type = (
                  statistics_pb2.Histogram.QUANTILES
              )
              nls.token_length_histogram.buckets.add(
                  low_value=low_value,
                  high_value=high_value,
                  sample_count=sample_count,
              )
      if sequence_len_quantiles:
          for (
              low_value,
              high_value,
              sample_count,
          ) in sequence_len_quantiles:
              nls.sequence_length_histogram.type = (
                  statistics_pb2.Histogram.QUANTILES
              )
              nls.sequence_length_histogram.buckets.add(
                  low_value=low_value,
                  high_value=high_value,
                  sample_count=sample_count,
              )
      if sorted_token_names_and_counts:
          for index, (token_name, count) in enumerate(
              sorted_token_names_and_counts
          ):
              nls.rank_histogram.buckets.add(
                  low_rank=index,
                  high_rank=index,
                  label=token_name,
                  sample_count=count,
              )
      if token_statistics:
          for k, v in token_statistics.items():
              ts = nls.token_statistics.add(
                  frequency=v[0],
                  fraction_of_sequences=v[1],
                  per_sequence_min_frequency=v[2],
                  per_sequence_max_frequency=v[3],
                  per_sequence_avg_frequency=v[4],
              )
              if isinstance(k, str):
                  ts.string_token = k
              else:
                  ts.int_token = k
              ts.positions.CopyFrom(v[5])
      if reported_sequences:
          for r in reported_sequences:
              nls.reported_sequences.append(str(r))
  
      custom_nl_stats = statistics_pb2.CustomStatistic(
          name="nl_statistics"
      )
      custom_nl_stats.any.Pack(nls)
      return statistics_pb2.FeatureNameStatistics(
          custom_stats=[custom_nl_stats]
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tempfile
  from absl.testing import absltest
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import natural_language_stats_generator
  from tensorflow_data_validation.utils import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 3 for calling the NaturalLanguageStatsGeneratorTest obj's underlying member method code with example usage: obj._create_expected_feature_name_statistics(feature_coverage, avg_token_length, min_sequence_length, max_sequence_length, token_len_quantiles, sequence_len_quantiles, sorted_token_names_and_counts, reported_sequences, token_statistics) and returns: statistics_pb2