class_docstr: Implements text match metric (word-level accuracy) for recognition task.
  
  The raw aggregated metric is computed as follows:
  
  .. math::
      \forall X, Y \in \mathcal{W}^N,
      TextMatch(X, Y) = \frac{1}{N} \sum\limits_{i=1}^N f_{Y_i}(X_i)
  
  with the indicator function :math:`f_{a}` defined as:
  
  .. math::
      \forall a, x \in \mathcal{W},
      f_a(x) = \left\{
          \begin{array}{ll}
              1 & \mbox{if } x = a \\
              0 & \mbox{otherwise.}
          \end{array}
      \right.
  
  where :math:`\mathcal{W}` is the set of all possible character sequences,
  :math:`N` is a strictly positive integer.
  
  >>> from doctr.utils import TextMatch
  >>> metric = TextMatch()
  >>> metric.update(['Hello', 'world'], ['hello', 'world'])
  >>> metric.summary()
class_docstr_tok: ["Implements","text","match","metric","(","word-level","accuracy",")","for","recognition","task",".","The","raw","aggregated","metric","is","computed","as","follows",":","..","math",":",":","\\forall","X",",","Y","\\in","\\mathcal","{","W","}","^N",",","TextMatch","(","X",",","Y",")","=","\\frac","{","1","}","{","N","}","\\sum\\limits_","{","i=1","}","^N","f_","{","Y_i","}","(","X_i",")","with","the","indicator","function",":","math",":","`","f_","{","a","}","`","defined","as",":","..","math",":",":","\\forall","a",",","x","\\in","\\mathcal","{","W","}",",","f_a","(","x",")","=","\\left\\","{","\\begin","{","array","}","{","ll","}","1","&","\\mbox","{","if","}","x","=","a","\\\\","0","&","\\mbox","{","otherwise",".","}","\\end","{","array","}","\\right",".","where",":","math",":","`","\\mathcal","{","W","}","`","is","the","set","of","all","possible","character","sequences",",",":","math",":","`","N","`","is","a","strictly","positive","integer",".",">",">",">","from","doctr.utils","import","TextMatch",">",">",">","metric","=","TextMatch","(",")",">",">",">","metric.update","(","[","'Hello","'",",","'world","'","]",",","[","'hello","'",",","'world","'","]",")",">",">",">","metric.summary","(",")"]
docstr: Update the state of the metric with new predictions
  
  Args:
  ----
      gt: list of groung-truth character sequences
      pred: list of predicted character sequences
docstr_tok: ["Update","the","state","of","the","metric","with","new","predictions","Args",":","--","--","gt",":","list","of","groung-truth","character","sequences","pred",":","list","of","predicted","character","sequences"]
code: def update(
      self,
      gt: List[str],
      pred: List[str],
  ) -> None:
      """Update the state of the metric with new predictions
  
      Args:
      ----
          gt: list of groung-truth character sequences
          pred: list of predicted character sequences
      """
      if len(gt) != len(pred):
          raise AssertionError(
              "prediction size does not match with ground-truth labels size"
          )
  
      for gt_word, pred_word in zip(gt, pred):
          _raw, _caseless, _unidecode, _unicase = string_match(
              gt_word, pred_word
          )
          self.raw += int(_raw)
          self.caseless += int(_caseless)
          self.unidecode += int(_unidecode)
          self.unicase += int(_unicase)
  
      self.total += len(gt)
  
imports: from typing import Dict, List, Optional, Tuple
  import cv2
  import numpy
  from scipy.optimize import linear_sum_assignment
  from unidecode import unidecode
label_desc: Use image node_id 2 for calling the TextMatch obj's underlying member method code with example usage: obj.update(gt, pred) without return types