docstr: Change the codec to the new `codec` but keep the positions of chars that are in both codecs.
  
  This function is used to compute a codec change: deleted labels, added characters.
  
  Parameters
  ----------
  codec : list of str
      Characters of the new codec
  shrink : bool
      Shrink the codec by unavailable chars
  extend : bool
      Extend new chars to the codec
  Returns
  -------
  list of int
      list of the deleted positions
  list of int
      list of the labels of the newly added characters
  See Also
  --------
      shrink
      extend
docstr_tok: ["Change","the","codec","to","the","new","`","codec","`","but","keep","the","positions","of","chars","that","are","in","both","codecs",".","This","function","is","used","to","compute","a","codec","change",":","deleted","labels",",","added","characters",".","Parameters","--","--","--","--","--","codec",":","list","of","str","Characters","of","the","new","codec","shrink",":","bool","Shrink","the","codec","by","unavailable","chars","extend",":","bool","Extend","new","chars","to","the","codec","Returns","--","--","--","-","list","of","int","list","of","the","deleted","positions","list","of","int","list","of","the","labels","of","the","newly","added","characters","See","Also","--","--","--","--","shrink","extend"]
code: def align(self, codec, shrink=True, extend=True):
      """Change the codec to the new `codec` but keep the positions of chars that are in both codecs.
  
      This function is used to compute a codec change: deleted labels, added characters.
  
      Parameters
      ----------
      codec : list of str
          Characters of the new codec
      shrink : bool
          Shrink the codec by unavailable chars
      extend : bool
          Extend new chars to the codec
      Returns
      -------
      list of int
          list of the deleted positions
      list of int
          list of the labels of the newly added characters
      See Also
      --------
          shrink
          extend
      """
      deleted_positions = self.shrink(codec) if shrink else []
      added_positions = self.extend(codec) if extend else []
      return deleted_positions, added_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 10 for calling the Codec obj's underlying member method code with example usage: obj.align(codec, shrink, extend) and returns: deleted_positions,  added_positions