class_docstr: A class designed for performing ASR and diarization together.
  
  Attributes:
      cfg_diarizer (OmegaConf):
          Hydra config for diarizer key
      params (OmegaConf):
          Parameters config in diarizer.asr
      ctc_decoder_params (OmegaConf)
          Hydra config for beam search decoder
      realigning_lm_params (OmegaConf):
          Hydra config for realigning language model
      manifest_filepath (str):
          Path to the input manifest path
      nonspeech_threshold (float):
          Threshold for VAD logits that are used for creating speech segments
      fix_word_ts_with_VAD (bool):
          Choose whether to fix word timestamps by using VAD results
      root_path (str):
          Path to the folder where diarization results are saved
      vad_threshold_for_word_ts (float):
          Threshold used for compensating word timestamps with VAD output
      max_word_ts_length_in_sec (float):
          Maximum limit for the duration of each word timestamp
      word_ts_anchor_offset (float):
          Offset for word timestamps from ASR decoders
      run_ASR:
          Placeholder variable for an ASR launcher function
      realigning_lm:
          Placeholder variable for a loaded ARPA Language model
      ctm_exists (bool):
          Boolean that indicates whether all files have the corresponding reference CTM file
      frame_VAD (dict):
          Dictionary containing frame-level VAD logits
      AUDIO_RTTM_MAP:
          Dictionary containing the input manifest information
      color_palette (dict):
          Dictionary containing the ANSI color escape codes for each speaker label (speaker index)
class_docstr_tok: ["A","class","designed","for","performing","ASR","and","diarization","together",".","Attributes",":","cfg_diarizer","(","OmegaConf",")",":","Hydra","config","for","diarizer","key","params","(","OmegaConf",")",":","Parameters","config","in","diarizer.asr","ctc_decoder_params","(","OmegaConf",")","Hydra","config","for","beam","search","decoder","realigning_lm_params","(","OmegaConf",")",":","Hydra","config","for","realigning","language","model","manifest_filepath","(","str",")",":","Path","to","the","input","manifest","path","nonspeech_threshold","(","float",")",":","Threshold","for","VAD","logits","that","are","used","for","creating","speech","segments","fix_word_ts_with_VAD","(","bool",")",":","Choose","whether","to","fix","word","timestamps","by","using","VAD","results","root_path","(","str",")",":","Path","to","the","folder","where","diarization","results","are","saved","vad_threshold_for_word_ts","(","float",")",":","Threshold","used","for","compensating","word","timestamps","with","VAD","output","max_word_ts_length_in_sec","(","float",")",":","Maximum","limit","for","the","duration","of","each","word","timestamp","word_ts_anchor_offset","(","float",")",":","Offset","for","word","timestamps","from","ASR","decoders","run_ASR",":","Placeholder","variable","for","an","ASR","launcher","function","realigning_lm",":","Placeholder","variable","for","a","loaded","ARPA","Language","model","ctm_exists","(","bool",")",":","Boolean","that","indicates","whether","all","files","have","the","corresponding","reference","CTM","file","frame_VAD","(","dict",")",":","Dictionary","containing","frame-level","VAD","logits","AUDIO_RTTM_MAP",":","Dictionary","containing","the","input","manifest","information","color_palette","(","dict",")",":","Dictionary","containing","the","ANSI","color","escape","codes","for","each","speaker","label","(","speaker","index",")"]
docstr: Evaluate the result transcripts based on the provided CTM file. WER and cpWER are calculated to assess
  the performance of ASR system and diarization at the same time.
  
  Args:
      audio_file_list (list):
          List containing file path to the input audio files.
      hyp_trans_info_dict (dict):
          Dictionary containing the hypothesis transcriptions for all sessions.
      hyp_ctm_file_list (list):
          List containing file paths of the hypothesis transcriptions in CTM format for all sessions.
      ref_ctm_file_list (list):
          List containing file paths of the reference transcriptions in CTM format for all sessions.
  
      Note: Either `hyp_trans_info_dict` or `hyp_ctm_file_list` should be provided.
  
  Returns:
      wer_results (dict):
          Session-by-session results including DER, miss rate, false alarm rate, WER and cpWER
docstr_tok: ["Evaluate","the","result","transcripts","based","on","the","provided","CTM","file",".","WER","and","cpWER","are","calculated","to","assess","the","performance","of","ASR","system","and","diarization","at","the","same","time",".","Args",":","audio_file_list","(","list",")",":","List","containing","file","path","to","the","input","audio","files",".","hyp_trans_info_dict","(","dict",")",":","Dictionary","containing","the","hypothesis","transcriptions","for","all","sessions",".","hyp_ctm_file_list","(","list",")",":","List","containing","file","paths","of","the","hypothesis","transcriptions","in","CTM","format","for","all","sessions",".","ref_ctm_file_list","(","list",")",":","List","containing","file","paths","of","the","reference","transcriptions","in","CTM","format","for","all","sessions",".","Note",":","Either","`","hyp_trans_info_dict","`","or","`","hyp_ctm_file_list","`","should","be","provided",".","Returns",":","wer_results","(","dict",")",":","Session-by-session","results","including","DER",",","miss","rate",",","false","alarm","rate",",","WER","and","cpWER"]
code: def evaluate(
      audio_file_list: List[str],
      hyp_trans_info_dict: Dict[str, Dict[str, float]],
      hyp_ctm_file_list: List[str] = None,
      ref_ctm_file_list: List[str] = None,
  ) -> Dict[str, Dict[str, float]]:
      """
      Evaluate the result transcripts based on the provided CTM file. WER and cpWER are calculated to assess
      the performance of ASR system and diarization at the same time.
  
      Args:
          audio_file_list (list):
              List containing file path to the input audio files.
          hyp_trans_info_dict (dict):
              Dictionary containing the hypothesis transcriptions for all sessions.
          hyp_ctm_file_list (list):
              List containing file paths of the hypothesis transcriptions in CTM format for all sessions.
          ref_ctm_file_list (list):
              List containing file paths of the reference transcriptions in CTM format for all sessions.
  
          Note: Either `hyp_trans_info_dict` or `hyp_ctm_file_list` should be provided.
  
      Returns:
          wer_results (dict):
              Session-by-session results including DER, miss rate, false alarm rate, WER and cpWER
      """
      wer_results = {}
  
      if ref_ctm_file_list is not None:
          spk_hypotheses, spk_references = [], []
          mix_hypotheses, mix_references = [], []
          WER_values, uniq_id_list = [], []
  
          for k, (audio_file_path, ctm_file_path) in enumerate(
              zip(audio_file_list, ref_ctm_file_list)
          ):
              uniq_id = get_uniqname_from_filepath(audio_file_path)
              uniq_id_list.append(uniq_id)
              if uniq_id != get_uniqname_from_filepath(ctm_file_path):
                  raise ValueError(
                      "audio_file_list has mismatch in uniq_id with ctm_file_path"
                  )
  
              # Either hypothesis CTM file or hyp_trans_info_dict should be provided
              if hyp_ctm_file_list is not None:
                  if uniq_id == get_uniqname_from_filepath(
                      hyp_ctm_file_list[k]
                  ):
                      (
                          spk_hypothesis,
                          mix_hypothesis,
                      ) = convert_ctm_to_text(hyp_ctm_file_list[k])
                  else:
                      raise ValueError(
                          "Hypothesis CTM files are provided but uniq_id is mismatched"
                      )
              elif (
                  hyp_trans_info_dict is not None
                  and uniq_id in hyp_trans_info_dict
              ):
                  (
                      spk_hypothesis,
                      mix_hypothesis,
                  ) = convert_word_dict_seq_to_text(
                      hyp_trans_info_dict[uniq_id]["words"]
                  )
              else:
                  raise ValueError(
                      "Hypothesis information is not provided in the correct format."
                  )
  
              spk_reference, mix_reference = convert_ctm_to_text(
                  ctm_file_path
              )
  
              spk_hypotheses.append(spk_hypothesis)
              spk_references.append(spk_reference)
              mix_hypotheses.append(mix_hypothesis)
              mix_references.append(mix_reference)
  
              # Calculate session by session WER value
              WER_values.append(
                  word_error_rate([mix_hypothesis], [mix_reference])
              )
  
          (
              cpWER_values,
              hyps_spk,
              refs_spk,
          ) = concat_perm_word_error_rate(
              spk_hypotheses, spk_references
          )
  
          # Take an average of cpWER and regular WER value on all sessions
          wer_results["total"] = {}
          wer_results["total"]["average_cpWER"] = word_error_rate(
              hypotheses=hyps_spk, references=refs_spk
          )
          wer_results["total"]["average_WER"] = word_error_rate(
              hypotheses=mix_hypotheses, references=mix_references
          )
  
          for uniq_id, cpWER, WER in zip(
              uniq_id_list, cpWER_values, WER_values
          ):
              # Save session-level cpWER and WER values
              wer_results[uniq_id] = {}
              wer_results[uniq_id]["cpWER"] = cpWER
              wer_results[uniq_id]["WER"] = WER
  
      return wer_results
  
imports: import copy
  import csv
  import json
  import os
  from collections import OrderedDict
  from datetime import datetime
  from typing import Dict, List, Tuple
  import numpy
  from nemo.collections.asr.metrics.der import concat_perm_word_error_rate
  from nemo.collections.asr.metrics.wer import word_error_rate
  from nemo.collections.asr.models import ClusteringDiarizer
  from nemo.collections.asr.parts.utils.speaker_utils import audio_rttm_map, get_uniqname_from_filepath, labels_to_rttmfile, rttm_to_labels, write_rttm2manifest
  from nemo.utils import logging
label_desc: Use image node_id 21 for calling the OfflineDiarWithASR obj's underlying member method code with example usage: obj.evaluate(audio_file_list, hyp_trans_info_dict, hyp_ctm_file_list, ref_ctm_file_list) and returns: wer_results