docstr: Saves a single text sample
  
  Arguments
  ---------
  tag: str
      the tag - for Tensorboard
  metrics_sample:  list
      List of wer details by utterance,
      see ``speechbrain.utils.edit_distance.wer_details_by_utterance``
      for format. Has to have alignments included.
docstr_tok: ["Saves","a","single","text","sample","Arguments","--","--","--","--","-","tag",":","str","the","tag","-","for","Tensorboard","metrics_sample",":","list","List","of","wer","details","by","utterance",",","see","``","speechbrain.utils.edit_distance.wer_details_by_utterance","``","for","format",".","Has","to","have","alignments","included","."]
code: def _save_text_alignment(self, tag, metrics_sample):
      """Saves a single text sample
  
      Arguments
      ---------
      tag: str
          the tag - for Tensorboard
      metrics_sample:  list
          List of wer details by utterance,
          see ``speechbrain.utils.edit_distance.wer_details_by_utterance``
          for format. Has to have alignments included.
      """
      with StringIO() as text_alignments_io:
          print_alignments(
              metrics_sample,
              file=text_alignments_io,
              print_header=False,
              sample_separator="\n  ---  \n",
          )
          text_alignments_io.seek(0)
          alignments_sample = text_alignments_io.read()
          alignments_sample_md = f"```\n{alignments_sample}\n```"
      self.tb_writer.add_text(
          tag, alignments_sample_md, self.tb_global_step
      )
  
imports: from speechbrain.dataio.dataset import FilteredSortedDynamicItemDataset, DynamicItemDataset
  from speechbrain.dataio.sampler import BalancingDataSampler
  from speechbrain.utils.data_utils import undo_padding
  import datasets
  import logging
  import os
  import random
  import speechbrain
  import sys
  from enum import Enum
  from collections import namedtuple
  from hyperpyyaml import load_hyperpyyaml
  from functools import partial
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.utils.pretrained import save_for_pretrained
  from speechbrain.lobes.models.g2p.dataio import enable_eos_bos, grapheme_pipeline, phoneme_pipeline, tokenizer_encode_pipeline, add_bos_eos, get_sequence_key, phonemes_to_label
  from speechbrain.dataio.wer import print_alignments
  from speechbrain.wordemb.util import expand_to_chars
  from io import StringIO
  from speechbrain.utils import hpopt
  import numpy
label_desc: Use image node_id 25 for calling the G2PBrain obj's underlying member method code with example usage: obj._save_text_alignment(tag, metrics_sample) without return types