code: def get_classification_result(
      hyp_file, ref_file, hyp_asr_file, ref_asr_file
  ):
      hyp_lines = [line for line in hyp_file]
      ref_lines = [line for line in ref_file]
  
      hyp_list = []
      ref_list = []
  
      hyp_asr_list = []
      ref_asr_list = []
  
      hyp_label_list = []
      ref_label_list = []
  
      for line_count in range(len(hyp_lines)):
          hyp_tokens = hyp_lines[line_count].split()
          ref_tokens = ref_lines[line_count].split()
  
          # The last "word" is utt_id
          hyp_id = hyp_tokens[-1]
          ref_id = ref_tokens[-1]
          assert hyp_id == ref_id, f"hyp_id: {hyp_id}, ref_id: {ref_id}"
  
          # Remove utt_id
          hyp_line = " ".join(hyp_tokens[:-1])
          ref_line = " ".join(ref_tokens[:-1])
  
          # De-tokenize
          hyp_line, hyp_line_asr = preprocess_sentence(hyp_line)
          ref_line, ref_line_asr = preprocess_sentence(ref_line)
  
          # Save results for computing F1
          hyp_list.append(process_line(hyp_line))
          ref_list.append(process_line(ref_line))
  
          # Pure ASR text without special tokens
          hyp_asr_list.append(hyp_line_asr + "\t" + hyp_id)
          ref_asr_list.append(ref_line_asr + "\t" + ref_id)
  
          # Save results for computing label-F1
          hyp_label_list.append(process_line(hyp_line, label_F1=True))
          ref_label_list.append(process_line(ref_line, label_F1=True))
  
      # NER F1 score
      metrics = eval_utils.get_ner_scores(ref_list, hyp_list)
  
      # Write ASR text for computing WER later
      for ln in hyp_asr_list:
          hyp_asr_file.write(ln + "\n")
      for ln in ref_asr_list:
          ref_asr_file.write(ln + "\n")
  
      # NER label-F1 score
      label_metrics = eval_utils.get_ner_scores(
          ref_label_list, hyp_label_list
      )
  
      return metrics, label_metrics
  
file_path: espnet/egs2/slue-voxpopuli/slu1/local/score.py
imports: import argparse
  import json
  import os
  import re
  import sys
  import eval_utils
  import pandas
label_desc: Use image node_id 4 for calling a global function with example usage: get_classification_result(hyp_file, ref_file, hyp_asr_file, ref_asr_file) and returns: metrics,  label_metrics