code: def _get_abbreviation_expansion_pairs(
      snippet: str,
      abbreviations_by_expansion: Mapping[str, Sequence[str]],
      expansion_regex: re.Pattern[str],
  ) -> dict[int, AbbrevExpansionPair]:
      """Extracts possible abbreviation-expansion pairs from a snippet."""
      index_to_pair = {}
      for match in expansion_regex.finditer(snippet):
          match_start = match.span(1)[0]
          expansion = match.group(1)
          abbrev = random.choice(abbreviations_by_expansion[expansion])
          index_to_pair[match_start] = (abbrev, expansion)
      return index_to_pair
  
file_path: datasets/tensorflow_datasets/text/c4_wsrs/c4_wsrs_utils.py
imports: from __future__ import annotations
  import collections
  import dataclasses
  import random
  import re
  from typing import Iterator, Mapping, Sequence, Tuple
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _get_abbreviation_expansion_pairs(snippet, abbreviations_by_expansion, expansion_regex) and returns: index_to_pair