code: def _get_wer(r: List[str], h: List[str]) -> WerScore:
      len_r, len_h = len(r), len(h)
      edits = [[0 for _ in range(len_h + 1)] for _ in range(len_r + 1)]
      pt = [
          [OperationType.correct for _ in range(len_h + 1)]
          for _ in range(len_r + 1)
      ]
  
      for i in range(1, len_r + 1):
          edits[i][0] = i
          pt[i][0] = OperationType.deletion
      for j in range(1, len_h + 1):
          edits[0][j] = j
          pt[0][j] = OperationType.insertion
      for i in range(1, len_r + 1):
          for j in range(1, len_h + 1):
              if r[i - 1] == h[j - 1]:
                  edits[i][j] = edits[i - 1][j - 1]
                  pt[i][j] = OperationType.correct
              else:
                  edits[i][j] = edits[i - 1][j - 1] + 1
                  pt[i][j] = OperationType.substitution
  
              if edits[i][j - 1] + 1 < edits[i][j]:
                  edits[i][j] = edits[i][j - 1] + 1
                  pt[i][j] = OperationType.insertion
  
              if edits[i - 1][j] + 1 < edits[i][j]:
                  edits[i][j] = edits[i - 1][j] + 1
                  pt[i][j] = OperationType.deletion
  
      i, j = len_r, len_h
      n_sub, n_del, n_ins = 0, 0, 0
      while i > 0 or j > 0:
          if pt[i][j] == OperationType.correct:
              i -= 1
              j -= 1
          elif pt[i][j] == OperationType.substitution:
              n_sub += 1
              i -= 1
              j -= 1
          elif pt[i][j] == OperationType.insertion:
              n_ins += 1
              j -= 1
          elif pt[i][j] == OperationType.deletion:
              n_del += 1
              i -= 1
  
      return WerScore(
          wer=100.0 * (n_sub + n_del + n_ins) / len_r,
          len_r=len_r,
          deletion=n_del,
          substitution=n_sub,
          insertion=n_ins,
      )
  
file_path: vizseq/vizseq/scorers/_wer.py
imports: from typing import List, NamedTuple
  from enum import Enum
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _get_wer(r, h) and returns: WerScore