code: def create_librispeech_ctm_alignments(
      input_manifest_filepath,
      base_alignment_path,
      ctm_output_directory,
      libri_dataset_split,
  ):
      """
      Create new CTM alignments using input LibriSpeech word alignments.
  
      Args:
          input_manifest_filepath (str): Path to the input LibriSpeech manifest file
          base_alignment_path (str): Path to the base directory containing the LibriSpeech word alignments
          ctm_source_dir (str): Directory to write the CTM files to
          libri_dataset_split (str): Which split of the LibriSpeech dataset is being used
      """
      manifest = read_manifest(input_manifest_filepath)
      unaligned_path = os.path.join(
          base_alignment_path, "unaligned.txt"
      )
  
      if os.path.exists(unaligned_path):
          unaligned_file_ids = set(get_unaligned_files(unaligned_path))
      else:
          unaligned_file_ids = set()
  
      libri_dataset_split = libri_dataset_split.replace("_", "-")
  
      # delete output directory if it exists or throw warning
      if os.path.isdir(ctm_output_directory):
          logging.info(
              f"Removing existing output directory: {ctm_output_directory}"
          )
          shutil.rmtree(ctm_output_directory)
      if not os.path.exists(ctm_output_directory):
          logging.info(
              f"Creating output directory: {ctm_output_directory}"
          )
          os.mkdir(ctm_output_directory)
  
      if len(manifest) == 0:
          raise Exception(
              f"Input manifest is empty: {input_manifest_filepath}"
          )
  
      for entry in manifest:
          audio_file = entry["audio_filepath"]
          file_id = Path(audio_file).stem
  
          if file_id in unaligned_file_ids:
              continue
  
          speaker_id = file_id.split("-")[0]
          book_id = file_id.split("-")[1]
          book_dir = os.path.join(
              base_alignment_path,
              "LibriSpeech",
              libri_dataset_split,
              speaker_id,
              book_id,
          )
          alignment_filepath = os.path.join(
              book_dir, f"{speaker_id}-{book_id}.alignment.txt"
          )
  
          alignment_data = load_librispeech_alignment(
              alignment_filepath
          )
          if file_id not in alignment_data:
              logging.warning(
                  f"Cannot find alignment data for {audio_file} in {alignment_filepath}"
              )
              continue
  
          words, end_times = alignment_data[file_id]
          words = words.replace('"', "").lower().split(",")
          end_times = [
              float(e) for e in end_times.replace('"', "").split(",")
          ]
  
          ctm_list = create_new_ctm_entry(
              file_id, speaker_id, words, end_times
          )
          write_ctm(
              os.path.join(ctm_output_directory, file_id + ".ctm"),
              ctm_list,
          )
  
file_path: NeMo/scripts/speaker_tasks/create_alignment_manifest.py
imports: import argparse
  import os
  import shutil
  from pathlib import Path
  from typing import List
  from nemo.collections.asr.parts.utils.manifest_utils import get_ctm_line, read_manifest, write_ctm, write_manifest
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: create_librispeech_ctm_alignments(input_manifest_filepath, base_alignment_path, ctm_output_directory, libri_dataset_split) without return types