code: def ngram_precrecf(matching, reflen, hyplen, beta):
      ngramPrec = defaultdict(float)
      ngramRec = defaultdict(float)
      ngramF = defaultdict(float)
  
      factor = beta**2
  
      for order in matching:
          if hyplen[order] > 0:
              ngramPrec[order] = matching[order] / hyplen[order]
          else:
              ngramPrec[order] = 1e-16
          if reflen[order] > 0:
              ngramRec[order] = matching[order] / reflen[order]
          else:
              ngramRec[order] = 1e-16
          denom = factor * ngramPrec[order] + ngramRec[order]
          if denom > 0:
              ngramF[order] = (
                  (1 + factor)
                  * ngramPrec[order]
                  * ngramRec[order]
                  / denom
              )
          else:
              ngramF[order] = 1e-16
  
      return ngramF, ngramRec, ngramPrec
  
file_path: TextBox/textbox/evaluator/utils/chrf.py
imports: import sys
  import math
  import unicodedata
  import argparse
  from collections import defaultdict
  import time
  import string
label_desc: Use image node_id 5 for calling a global function with example usage: ngram_precrecf(matching, reflen, hyplen, beta) and returns: ngramF,  ngramRec,  ngramPrec