code: def mymain(test_loc, gold_loc, eval_punct=False):
      if not os.path.exists(test_loc):
          test_loc.mkdir()
      n_by_label = defaultdict(lambda: defaultdict(int))
      u_by_label = defaultdict(lambda: defaultdict(int))
      l_by_label = defaultdict(lambda: defaultdict(int))
      N = 0
      u_nc = 0
      l_nc = 0
      for (sst, t), (ss, g) in zip(
          gen_toks(test_loc), gen_toks(gold_loc)
      ):
          if not eval_punct and g.word in ",.-;:'\"!?`{}()[]":
              continue
          prev_g = g
          prev_t = t
          u_c = g.head == t.head
          l_c = u_c and g.label.lower() == t.label.lower()
          N += 1
          l_nc += l_c
          u_nc += u_c
          n_by_label[g.dir][g.label] += 1
          u_by_label[g.dir][g.label] += u_c
          l_by_label[g.dir][g.label] += l_c
      n_l_err = N - l_nc
      for D in ["L", "R"]:
          n_other = 0
          l_other = 0
          u_other = 0
          for label, n in sorted(
              n_by_label[D].items(), key=lambda i: i[1], reverse=True
          ):
              if n == 0:
                  continue
              elif n < 100:
                  n_other += n
                  l_other += l_by_label[D][label]
                  u_other += u_by_label[D][label]
              else:
                  l_corr = l_by_label[D][label]
                  u_corr = u_by_label[D][label]
      yield "U: %.3f" % pc(u_nc, N)
      yield "L: %.3f" % pc(l_nc, N)
  
file_path: vowpal_wabbit/demo/dependencyparsing/evaluate.py
imports: import os
  import sys
  from collections import defaultdict
label_desc: Use image node_id 4 for calling a global function with example usage: mymain(test_loc, gold_loc, eval_punct) without return types