class_docstr: Component that uses statistics based error model to find best candidates in a static dictionary.
  Based on An Improved Error Model for Noisy Channel Spelling Correction by Eric Brill and Robert C. Moore
  
  Args:
      dictionary: a :class:`~deeppavlov.vocabs.typos.StaticDictionary` object
      window: maximum context window size
      candidates_count: maximum number of replacement candidates to return for every token in the input
  
  Attributes:
      costs: logarithmic probabilities of character sequences replacements
      dictionary: a :class:`~deeppavlov.vocabs.typos.StaticDictionary` object
      window: maximum context window size
      candidates_count: maximum number of replacement candidates to return for every token in the input
code: def __init__(
      self,
      dictionary: StaticDictionary,
      window: int = 1,
      candidates_count: int = 1,
      *args,
      **kwargs,
  ):
      super().__init__(*args, **kwargs)
      self.costs = defaultdict(itertools.repeat(float("-inf")).__next__)
      self.dictionary = dictionary
      self.window = window
      if self.window == 0:
          self.find_candidates = self._find_candidates_window_0
      else:
          self.find_candidates = self._find_candidates_window_n
      self.costs[("", "")] = log(1)
      self.costs[("⟬", "⟬")] = log(1)
      self.costs[("⟭", "⟭")] = log(1)
  
      for c in self.dictionary.alphabet:
          self.costs[(c, c)] = log(1)
      # if self.ser_path.is_file():
      self.load()
  
      self.candidates_count = candidates_count
  
imports: import csv
  import itertools
  from collections import defaultdict, Counter
  from heapq import heappop, heappushpop, heappush
  from logging import getLogger
  from math import log, exp
  from typing import List, Iterable, Tuple
  from tqdm import tqdm
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.estimator import Estimator
  from deeppavlov.vocabs.typos import StaticDictionary
label_desc: Use image node_id 1 to create a new ErrorModel object from inherited base classes: Estimator with example: obj = ErrorModel(dictionary, window, candidates_count)