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: Gather diarization evaluation results from pyannote DiarizationErrorRate metric object.
  
  Args:
      metric (DiarizationErrorRate metric):
          DiarizationErrorRate metric pyannote object
      trans_info_dict (dict):
          Dictionary containing word timestamps, speaker labels and words from all sessions.
          Each session is indexed by unique ID as a key.
      mapping_dict (dict):
          Dictionary containing speaker mapping labels for each audio file with key as unique name
      decimals (int):
          The number of rounding decimals for DER value
  
  Returns:
      der_results (dict):
          Dictionary containing scores for each audio file along with aggregated results
docstr_tok: ["Gather","diarization","evaluation","results","from","pyannote","DiarizationErrorRate","metric","object",".","Args",":","metric","(","DiarizationErrorRate","metric",")",":","DiarizationErrorRate","metric","pyannote","object","trans_info_dict","(","dict",")",":","Dictionary","containing","word","timestamps",",","speaker","labels","and","words","from","all","sessions",".","Each","session","is","indexed","by","unique","ID","as","a","key",".","mapping_dict","(","dict",")",":","Dictionary","containing","speaker","mapping","labels","for","each","audio","file","with","key","as","unique","name","decimals","(","int",")",":","The","number","of","rounding","decimals","for","DER","value","Returns",":","der_results","(","dict",")",":","Dictionary","containing","scores","for","each","audio","file","along","with","aggregated","results"]
code: def gather_eval_results(
      diar_score,
      audio_rttm_map_dict: Dict[str, Dict[str, str]],
      trans_info_dict: Dict[str, Dict[str, float]],
      root_path: str,
      decimals: int = 4,
  ) -> Dict[str, Dict[str, float]]:
      """
      Gather diarization evaluation results from pyannote DiarizationErrorRate metric object.
  
      Args:
          metric (DiarizationErrorRate metric):
              DiarizationErrorRate metric pyannote object
          trans_info_dict (dict):
              Dictionary containing word timestamps, speaker labels and words from all sessions.
              Each session is indexed by unique ID as a key.
          mapping_dict (dict):
              Dictionary containing speaker mapping labels for each audio file with key as unique name
          decimals (int):
              The number of rounding decimals for DER value
  
      Returns:
          der_results (dict):
              Dictionary containing scores for each audio file along with aggregated results
      """
      metric, mapping_dict, _ = diar_score
      results = metric.results_
      der_results = {}
      count_correct_spk_counting = 0
      for result in results:
          key, score = result
          if "hyp_rttm_filepath" in audio_rttm_map_dict[key]:
              pred_rttm = audio_rttm_map_dict[key]["hyp_rttm_filepath"]
          else:
              pred_rttm = os.path.join(
                  root_path, "pred_rttms", key + ".rttm"
              )
          pred_labels = rttm_to_labels(pred_rttm)
  
          ref_rttm = audio_rttm_map_dict[key]["rttm_filepath"]
          ref_labels = rttm_to_labels(ref_rttm)
          ref_n_spk = get_num_of_spk_from_labels(ref_labels)
          est_n_spk = get_num_of_spk_from_labels(pred_labels)
  
          _DER, _CER, _FA, _MISS = (
              (
                  score["confusion"]
                  + score["false alarm"]
                  + score["missed detection"]
              )
              / score["total"],
              score["confusion"] / score["total"],
              score["false alarm"] / score["total"],
              score["missed detection"] / score["total"],
          )
  
          der_results[key] = {
              "DER": round(_DER, decimals),
              "CER": round(_CER, decimals),
              "FA": round(_FA, decimals),
              "MISS": round(_MISS, decimals),
              "est_n_spk": est_n_spk,
              "ref_n_spk": ref_n_spk,
              "mapping": mapping_dict[key],
          }
          count_correct_spk_counting += int(est_n_spk == ref_n_spk)
  
      DER, CER, FA, MISS = (
          abs(metric),
          metric["confusion"] / metric["total"],
          metric["false alarm"] / metric["total"],
          metric["missed detection"] / metric["total"],
      )
      der_results["total"] = {
          "DER": DER,
          "CER": CER,
          "FA": FA,
          "MISS": MISS,
          "spk_counting_acc": count_correct_spk_counting
          / len(metric.results_),
      }
  
      return der_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 12 for calling the OfflineDiarWithASR obj's underlying member method code with example usage: obj.gather_eval_results(diar_score, audio_rttm_map_dict, trans_info_dict, root_path, decimals) and returns: der_results