docstr: remove the given `codec` from this Codec
  
  This algorithm will compute the positions of the codes in the old charset and ignore non present chars.
  This output can then be used to delete specific nodes in the neural net.
  
  Parameters
  ----------
  codec : list of str
      chars to remove if present
  Returns
  -------
  list of int
      positions/labels of the chars that shall be removed on the old charset
docstr_tok: ["remove","the","given","`","codec","`","from","this","Codec","This","algorithm","will","compute","the","positions","of","the","codes","in","the","old","charset","and","ignore","non","present","chars",".","This","output","can","then","be","used","to","delete","specific","nodes","in","the","neural","net",".","Parameters","--","--","--","--","--","codec",":","list","of","str","chars","to","remove","if","present","Returns","--","--","--","-","list","of","int","positions\/labels","of","the","chars","that","shall","be","removed","on","the","old","charset"]
code: def shrink(self, codec):
      """remove the given `codec` from this Codec
  
      This algorithm will compute the positions of the codes in the old charset and ignore non present chars.
      This output can then be used to delete specific nodes in the neural net.
  
      Parameters
      ----------
      codec : list of str
          chars to remove if present
      Returns
      -------
      list of int
          positions/labels of the chars that shall be removed on the old charset
      """
      deleted_positions = []
      positions = []
      for number, char in self.code2char.items():
          if char not in codec.char2code:
              deleted_positions.append(number)
          else:
              positions.append(number)
  
      self.charset = [self.code2char[c] for c in sorted(positions)]
      self.code2char = {}
      self.char2code = {}
      for code, char in enumerate(self.charset):
          self.code2char[code] = char
          self.char2code[char] = code
  
      return deleted_positions
  
file_path: calamari/calamari_ocr/ocr/dataset/codec.py
imports: from dataclasses import dataclass, field
  from typing import List, TYPE_CHECKING, Iterator, Set
  from paiargparse import pai_dataclass, pai_meta
  from tfaip.util.multiprocessing.parallelmap import tqdm_wrapper
  from tfaip.data.pipeline.definitions import PipelineMode
  from calamari_ocr.utils import glob_all
label_desc: Use image node_id 9 for calling the Codec obj's underlying member method code with example usage: obj.shrink(codec) and returns: deleted_positions