code: def get_metrics(correct_num, predict_num, gold_num):
      p = correct_num / predict_num if predict_num > 0 else 0
      r = correct_num / gold_num if gold_num > 0 else 0
      f1 = 2 * p * r / (p + r) if (p + r) > 0 else 0
      return {
          "correct_num": correct_num,
          "predict_num": predict_num,
          "gold_num": gold_num,
          "precision": p,
          "recall": r,
          "f1": f1,
      }
  
file_path: DeepKE/src/deepke/triple_extraction/PRGC/evaluate.py
imports: import json
  import logging
  import random
  import argparse
  from tqdm import tqdm
  import os
  import torch
  import numpy
  import pandas
  from .metrics import tag_mapping_nearest, tag_mapping_corres
  from .util import *
  from .dataloader import CustomDataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: get_metrics(correct_num, predict_num, gold_num) and returns: dict