class_docstr: DatasetBuilder for C4-WSRS dataset.
class_docstr_tok: ["DatasetBuilder","for","C4-WSRS","dataset","."]
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(
      self,
      split: str,
      abbreviations_by_expansion: Mapping[str, Sequence[str]],
  ):
      """Yields examples."""
  
      def _process_example(element: tuple[str, WSRSFeatures]):
          key, features = element
          return key, {
              "original_snippet": features.original_snippet,
              "abbreviated_snippet": features.abbreviated_snippet,
          }
  
      expansion_re = c4_wsrs_utils.create_word_finder_regex(
          sorted(
              abbreviations_by_expansion.keys(), key=len, reverse=True
          )
      )
  
      beam = tfds.core.lazy_imports.apache_beam
  
      builder = tfds.builder("c4", config="en", version="3.1.0")
      return (
          tfds.beam.ReadFromTFDS(
              builder, split=split, workers_per_shard=10
          )
          | "AsNumpy" >> beam.Map(tfds.as_numpy)
          | "ExtractSnippets"
          >> beam.FlatMap(
              c4_wsrs_utils.extract_snippets,
              self.builder_config.max_sentences_per_snippet,
              abbreviations_by_expansion,
              expansion_re,
              self.builder_config.max_snippet_char_len,
              self.builder_config.alpha_keep_no_rs,
              self.builder_config.alpha_keep_rs,
          )
          | "ReshuffleSnippets1" >> beam.Reshuffle()
          | "ReverseSubstitution"
          >> beam.FlatMap(
              c4_wsrs_utils.reverse_substitution,
              self.builder_config.subsitution_rate,
              self.builder_config.min_snippet_token_len,
          )
          | "GroupByRarestSubstitution" >> beam.GroupByKey()
          | "SampleSnippetsByRarestSubstitution"
          >> beam.FlatMap(
              c4_wsrs_utils.sample_snippets_by_substitution,
              self.builder_config.num_snippets_per_substitution,
          )
          | "ReshuffleSnippets2" >> beam.Reshuffle()
          | "ProcessExamples" >> beam.Map(_process_example)
      )
  
file_path: datasets/tensorflow_datasets/text/c4_wsrs/c4_wsrs.py
imports: from __future__ import annotations
  import collections
  import csv
  from typing import Mapping, Sequence
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
  from tensorflow_datasets.text.c4_wsrs import c4_wsrs_utils
label_desc: Use image node_id 3 for calling the C4WSRS obj's underlying member method code with example usage: obj._generate_examples(split, abbreviations_by_expansion) and returns: unknown, key,  dict