code: def ngram_counts(wordList, order):
      counts = defaultdict(lambda: defaultdict(float))
      nWords = len(wordList)
      for i in range(nWords):
          for j in range(1, order + 1):
              if i + j <= nWords:
                  ngram = tuple(wordList[i : i + j])
                  counts[j - 1][ngram] += 1
  
      return counts
  
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 3 for calling a global function with example usage: ngram_counts(wordList, order) and returns: counts