code: def ngram_matches(ref_ngrams, hyp_ngrams):
      matchingNgramCount = defaultdict(float)
      totalRefNgramCount = defaultdict(float)
      totalHypNgramCount = defaultdict(float)
  
      for order in ref_ngrams:
          for ngram in hyp_ngrams[order]:
              totalHypNgramCount[order] += hyp_ngrams[order][ngram]
          for ngram in ref_ngrams[order]:
              totalRefNgramCount[order] += ref_ngrams[order][ngram]
              if ngram in hyp_ngrams[order]:
                  matchingNgramCount[order] += min(
                      ref_ngrams[order][ngram], hyp_ngrams[order][ngram]
                  )
  
      return matchingNgramCount, totalRefNgramCount, totalHypNgramCount
  
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 4 for calling a global function with example usage: ngram_matches(ref_ngrams, hyp_ngrams) and returns: matchingNgramCount,  totalRefNgramCount,  totalHypNgramCount