class_docstr: Component for encoding all strings to utf8 codes
  
  Args:
      max_word_length: Max length of words of input and output batches.
      pad_special_char_use: Whether to use special char for padding  or not.
      word_boundary_special_char_use: Whether to add word boundaries by special chars or not.
      sentence_boundary_special_char_use: Whether to add word boundaries by special chars or not.
      reversed_sentense_tokens: Whether to use reversed sequences of tokens or not.
      bos: Name of a special token of the begin of a sentence.
      eos: Name of a special token of the end of a sentence.
class_docstr_tok: ["Component","for","encoding","all","strings","to","utf8","codes","Args",":","max_word_length",":","Max","length","of","words","of","input","and","output","batches",".","pad_special_char_use",":","Whether","to","use","special","char","for","padding","or","not",".","word_boundary_special_char_use",":","Whether","to","add","word","boundaries","by","special","chars","or","not",".","sentence_boundary_special_char_use",":","Whether","to","add","word","boundaries","by","special","chars","or","not",".","reversed_sentense_tokens",":","Whether","to","use","reversed","sequences","of","tokens","or","not",".","bos",":","Name","of","a","special","token","of","the","begin","of","a","sentence",".","eos",":","Name","of","a","special","token","of","the","end","of","a","sentence","."]
code: def __init__(
      self,
      max_word_length: int = 50,
      pad_special_char_use: bool = False,
      word_boundary_special_char_use: bool = False,
      sentence_boundary_special_char_use: bool = False,
      reversed_sentense_tokens: bool = False,
      bos: str = "<S>",
      eos: str = "</S>",
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
  
      if word_boundary_special_char_use and max_word_length < 3:
          raise ConfigError(f"`max_word_length` should be more than 3!")
      if max_word_length < 1:
          raise ConfigError(f"`max_word_length` should be more than 1!")
  
      self._max_word_length = max_word_length
      self._reverse = reversed_sentense_tokens
  
      self._pad_special_char_use = pad_special_char_use
      self._word_boundary_special_char_use = (
          word_boundary_special_char_use
      )
      self._sentence_boundary_special_char_use = (
          sentence_boundary_special_char_use
      )
  
      # char ids 0-255 come from utf-8 encoding bytes
      # assign 256-300 to special chars
      self.bos_char = 256  # <begin sentence>
      self.eos_char = 257  # <end sentence>
      self.bow_char = 258  # <begin word>
      self.eow_char = 259  # <end word>
      self.pad_char = 260  # <padding>
  
      self._len = 261  # an upper bound of all indexes
  
      # the charcter representation of the begin/end of sentence characters
      def _make_bos_eos(indx):
          indx = np.array([indx], dtype=np.int32)
          if self._word_boundary_special_char_use:
              code = np.pad(
                  indx,
                  (1, 1),
                  "constant",
                  constant_values=(self.bow_char, self.eow_char),
              )
          else:
              code = indx
          if self._pad_special_char_use:
              code = np.pad(
                  code,
                  (0, self._max_word_length - code.shape[0]),
                  "constant",
                  constant_values=(self.pad_char),
              )
          else:
              pass
          return code
  
      self.bos_chars = _make_bos_eos(self.bos_char)
      self.eos_chars = _make_bos_eos(self.eos_char)
  
      if self._sentence_boundary_special_char_use:
          self._eos_chars = [self.eos_chars]
          self._bos_chars = [self.bos_chars]
      else:
          self._eos_chars = []
          self._bos_chars = []
  
      if self.load_path:
          self.load()
      else:
          self.tokens = []
      self._word_char_ids = OrderedDict()
  
      for token in self.tokens:
          self._word_char_ids[token] = self._convert_word_to_char_ids(
              token
          )
      self._word_char_ids[bos] = self.bos_chars
      self._word_char_ids[eos] = self.eos_chars
  
imports: from collections import Counter, OrderedDict
  from itertools import chain
  from logging import getLogger
  from typing import Union, List, Tuple
  import numpy
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.estimator import Estimator
label_desc: Use image node_id 1 to create a new StrUTF8Encoder object from inherited base classes: Estimator with example: obj = StrUTF8Encoder(max_word_length, pad_special_char_use, word_boundary_special_char_use, sentence_boundary_special_char_use, reversed_sentense_tokens, bos, eos)