class_docstr: Task object for CTC segmentation.
  
  This object is automatically generated and acts as
  a container for results of a CTCSegmentation object.
  
  When formatted with str(·), this object returns
  results in a kaldi-style segments file formatting.
  The human-readable output can be configured with
  the printing options.
  
  Attributes
  ----------
  text : list
      Utterance texts, separated by line. But without the utterance
          name at the beginning of the line (as in kaldi-style text).
  ground_truth_mat : array
      Ground truth matrix (CTC segmentation).
  utt_begin_indices : np.ndarray
      Utterance separator for the Ground truth matrix.
  timings : np.ndarray
      Time marks of the corresponding chars.
  state_list : list
      Estimated alignment of chars/tokens.
  segments : list
      Calculated segments as: (start, end, confidence score).
  config : CtcSegmentationParameters
      CTC Segmentation configuration object.
  name : str
      Name of aligned audio file (Optional). If given, name is
      considered when generating the text.
      Default: "utt".
  utt_ids : list
      The list of utterance names (Optional). This list should
      have the same length as the number of utterances.
  lpz : np.ndarray
      CTC posterior log probabilities (Optional).
  print_confidence_score : bool
      Include the confidence score.
      Default: True.
  print_utterance_text : bool
      Include utterance text.
      Default: True.
docstr: Return a kaldi-style ``segments`` file (string).
docstr_tok: ["Return","a","kaldi-style","``","segments","``","file","(","string",")","."]
code: def __str__(self):
      """Return a kaldi-style ``segments`` file (string)."""
      output = ""
      num_utts = len(self.segments)
      if self.utt_ids is None:
          utt_names = [f"{self.name}_{i:04}" for i in range(num_utts)]
      else:
          # ensure correct mapping of segments to utterance ids
          assert num_utts == len(self.utt_ids)
          utt_names = self.utt_ids
      for i, boundary in enumerate(self.segments):
          # utterance name and file name
          utt_entry = f"{utt_names[i]} {self.name} "
          # segment start and end
          utt_entry += f"{boundary[0]:.2f} {boundary[1]:.2f}"
          # confidence score
          if self.print_confidence_score:
              utt_entry += f" {boundary[2]:3.4f}"
          # utterance ground truth
          if self.print_utterance_text:
              utt_entry += f" {self.text[i]}"
          output += utt_entry + "\n"
      return output
  
imports: import logging
  from pathlib import Path
  from types import SimpleNamespace
  from typing import Optional
  from typing import Union
  import numpy
  import torch
  from typing import List
  from speechbrain.inference.ASR import EncoderASR, EncoderDecoderASR
label_desc: Use image node_id 2 for calling the CTCSegmentationTask obj's underlying member method code with example usage: obj.__str__() and returns: output