class_docstr: Class for processing and loading text to speech training examples.
  
  Args:
      dataset_meta: Dict of dataset names (string) to dataset metadata.
      sample_rate: Sample rate to load audio as. If the audio is stored at a different sample rate, then it will
          be resampled.
      text_tokenizer: Tokenizer to apply to the text field.
      weighted_sampling_steps_per_epoch: Optional int, If provided, then data will be sampled (with replacement) based on
          the sample weights provided in the dataset metadata. If None, then sample weights will be ignored.
      speaker_path: Optional, path to JSON file with speaker indices, for multi-speaker training. Can be created with
          scripts.dataset_processing.tts.create_speaker_map.py
      featurizers: Optional, list of featurizers to load feature data from. Should be the same config provided
          when running scripts.dataset_processing.tts.compute_features.py before training.
      feature_processors: Optional, list of feature processors to run on training examples.
      align_prior_hop_length: Optional int, hop length of audio features.
          If provided alignment prior will be calculated and included in batch output. Must match hop length
          of audio features used for training.
      min_duration: Optional float, if provided audio files in the training manifest shorter than 'min_duration'
          will be ignored.
      max_duration: Optional float, if provided audio files in the training manifest longer than 'max_duration'
          will be ignored.
      volume_norm: Whether to apply volume normalization to loaded audio.
class_docstr_tok: ["Class","for","processing","and","loading","text","to","speech","training","examples",".","Args",":","dataset_meta",":","Dict","of","dataset","names","(","string",")","to","dataset","metadata",".","sample_rate",":","Sample","rate","to","load","audio","as",".","If","the","audio","is","stored","at","a","different","sample","rate",",","then","it","will","be","resampled",".","text_tokenizer",":","Tokenizer","to","apply","to","the","text","field",".","weighted_sampling_steps_per_epoch",":","Optional","int",",","If","provided",",","then","data","will","be","sampled","(","with","replacement",")","based","on","the","sample","weights","provided","in","the","dataset","metadata",".","If","None",",","then","sample","weights","will","be","ignored",".","speaker_path",":","Optional",",","path","to","JSON","file","with","speaker","indices",",","for","multi-speaker","training",".","Can","be","created","with","scripts.dataset_processing.tts.create_speaker_map.py","featurizers",":","Optional",",","list","of","featurizers","to","load","feature","data","from",".","Should","be","the","same","config","provided","when","running","scripts.dataset_processing.tts.compute_features.py","before","training",".","feature_processors",":","Optional",",","list","of","feature","processors","to","run","on","training","examples",".","align_prior_hop_length",":","Optional","int",",","hop","length","of","audio","features",".","If","provided","alignment","prior","will","be","calculated","and","included","in","batch","output",".","Must","match","hop","length","of","audio","features","used","for","training",".","min_duration",":","Optional","float",",","if","provided","audio","files","in","the","training","manifest","shorter","than","'min_duration'","will","be","ignored",".","max_duration",":","Optional","float",",","if","provided","audio","files","in","the","training","manifest","longer","than","'max_duration'","will","be","ignored",".","volume_norm",":","Whether","to","apply","volume","normalization","to","loaded","audio","."]
code: def _preprocess_manifest(
      self,
      dataset_name: str,
      dataset: DatasetMeta,
      min_duration: float,
      max_duration: float,
      speaker_index_map: Dict[str, int],
  ):
      entries = read_manifest(dataset.manifest_path)
      (
          filtered_entries,
          total_hours,
          filtered_hours,
      ) = filter_dataset_by_duration(
          entries=entries,
          min_duration=min_duration,
          max_duration=max_duration,
      )
  
      logging.info(dataset_name)
      logging.info(f"Original # of files: {len(entries)}")
      logging.info(f"Filtered # of files: {len(filtered_entries)}")
      logging.info(f"Original duration: {total_hours:.2f} hours")
      logging.info(f"Filtered duration: {filtered_hours:.2f} hours")
  
      samples = []
      sample_weights = []
      for entry in filtered_entries:
          if "normalized_text" in entry:
              text = entry["normalized_text"]
          else:
              text = entry["text"]
  
          if self.include_speaker:
              speaker = entry["speaker"]
              speaker_index = speaker_index_map[speaker]
          else:
              speaker = None
              speaker_index = 0
  
          sample = DatasetSample(
              dataset_name=dataset_name,
              manifest_entry=entry,
              audio_dir=Path(dataset.audio_dir),
              feature_dir=Path(dataset.feature_dir),
              text=text,
              speaker=speaker,
              speaker_index=speaker_index,
          )
          samples.append(sample)
          sample_weights.append(dataset.sample_weight)
  
      return samples, sample_weights
  
imports: import json
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Dict, List, Optional
  import librosa
  import torch.utils.data
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest
  from nemo.collections.common.tokenizers.text_to_speech.tts_tokenizers import BaseTokenizer
  from nemo.collections.tts.parts.preprocessing.feature_processors import FeatureProcessor
  from nemo.collections.tts.parts.preprocessing.features import Featurizer
  from nemo.collections.tts.parts.utils.tts_dataset_utils import beta_binomial_prior_distribution, filter_dataset_by_duration, get_weighted_sampler, load_audio, stack_tensors
  from nemo.core.classes import Dataset
  from nemo.utils import logging
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 3 for calling the TextToSpeechDataset obj's underlying member method code with example usage: obj._preprocess_manifest(dataset_name, dataset, min_duration, max_duration, speaker_index_map) and returns: samples,  sample_weights