code: def generation_main(filename):
      docs = read_jsonl(filename)
      docs = sort_by_f1(docs)
      bleu = DialogueGenerationMetrics.get_bleu(
          [doc["generated"] for doc in docs],
          [doc["ground_truth"] for doc in docs],
      )
      acc = (
          np.mean(
              [
                  int(doc["generated"] == doc["ground_truth"])
                  for doc in docs
              ]
          )
          * 100
      )
      f1 = np.mean([doc["f1"] for doc in docs])
      print("Token level F1 is {:.3}".format(f1))
      print("BLEU is {:.3}".format(bleu))
      print("Exact match accuracy is {:.3}".format(acc))
      for i in range(0):
          print(docs[i])
  
file_path: NeMo/examples/nlp/dialogue/analyse_prediction_results.py
imports: import argparse
  import json
  import re
  import numpy
  from nemo.collections.nlp.metrics.dialogue_metrics import DialogueGenerationMetrics
label_desc: Use image node_id 6 for calling a global function with example usage: generation_main(filename) without return types