code: def score_cooked(allcomps, n=4, ground=0, smooth=1):
      totalcomps = {
          "testlen": 0,
          "reflen": 0,
          "guess": [0] * n,
          "correct": [0] * n,
      }
      for comps in allcomps:
          for key in ["testlen", "reflen"]:
              totalcomps[key] += comps[key]
          for key in ["guess", "correct"]:
              for k in range(n):
                  totalcomps[key][k] += comps[key][k]
      logbleu = 0.0
      all_bleus = []
      for k in range(n):
          correct = totalcomps["correct"][k]
          guess = totalcomps["guess"][k]
          addsmooth = 0
          if smooth == 1 and k > 0:
              addsmooth = 1
          logbleu += math.log(
              correct + addsmooth + sys.float_info.min
          ) - math.log(guess + addsmooth + sys.float_info.min)
          if guess == 0:
              all_bleus.append(-10000000)
          else:
              all_bleus.append(
                  math.log(correct + sys.float_info.min)
                  - math.log(guess)
              )
  
      logbleu /= float(n)
      all_bleus.insert(0, logbleu)
  
      brevPenalty = min(
          0,
          1
          - float(totalcomps["reflen"] + 1)
          / (totalcomps["testlen"] + 1),
      )
      for i in range(len(all_bleus)):
          if i == 0:
              all_bleus[i] += brevPenalty
          all_bleus[i] = math.exp(all_bleus[i])
      return all_bleus
  
file_path: codet5/CodeT5/evaluator/smooth_bleu.py
imports: import sys, math, re, xml.sax.saxutils
  import subprocess
  import os
label_desc: Use image node_id 5 for calling a global function with example usage: score_cooked(allcomps, n, ground, smooth) and returns: all_bleus