

from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer


__A      		=     logging.get_logger(__name__)

__A      		=     {'''vocab_file''': '''vocab.json''', '''merges_file''': '''merges.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__A      		=     {
    '''vocab_file''': {
        '''allegro/herbert-base-cased''': '''https://huggingface.co/allegro/herbert-base-cased/resolve/main/vocab.json'''
    },
    '''merges_file''': {
        '''allegro/herbert-base-cased''': '''https://huggingface.co/allegro/herbert-base-cased/resolve/main/merges.txt'''
    },
}

__A      		=     {'''allegro/herbert-base-cased''': 5_14}
__A      		=     {}



class   lowercase_   (  __lowercase					):
      UpperCamelCase_      :		Any										=    VOCAB_FILES_NAMES
      UpperCamelCase_      :		Optional[int]										=    PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase_      :		List[str]										=    PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase_      :		Dict										=    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase_      :		Optional[Any]										=    HerbertTokenizer



      def __init__(      self				:    Tuple      , A__				:    str=None      , A__				:    Optional[Any]=None      , A__				:    Union[str, Any]=None      , A__				:    Optional[int]="<s>"      , A__				:    Optional[int]="<unk>"      , A__				:    str="<pad>"      , A__				:    List[Any]="<mask>"      , A__				:    Dict="</s>"      , **A__				:    Optional[int]      , )   ->					Optional[int]:
        super().__init__(
            A__      , A__      , tokenizer_file=A__      , cls_token=A__      , unk_token=A__      , pad_token=A__      , mask_token=A__      , sep_token=A__      , **A__      , )



      def 						UpperCamelCase_		(      self				:    str      , A__				:    List[int]      , A__				:    Optional[List[int]] = None		)   ->					List[int]:
        _snake_case						=							[self.cls_token_id]
        _snake_case						=							[self.sep_token_id]
        if token_ids_a is None:
          return cls + token_ids_a + sep

        return cls + token_ids_a + sep + token_ids_a + sep



      def 						UpperCamelCase_		(      self				:    Tuple      , A__				:    List[int]      , A__				:    Optional[List[int]] = None      , A__				:    bool = False		)   ->					List[int]:
        if already_has_special_tokens:
          return super().get_special_tokens_mask(
              token_ids_a=A__      , token_ids_a=A__      , already_has_special_tokens=A__		)

        if token_ids_a is None:
          return [1] + ([0] * len(A__		)) + [1]
        return [1] + ([0] * len(A__		)) + [1] + ([0] * len(A__		)) + [1]



      def 						UpperCamelCase_		(      self				:    Any      , A__				:    List[int]      , A__				:    Optional[List[int]] = None		)   ->					List[int]:
        _snake_case						=							[self.sep_token_id]
        _snake_case						=							[self.cls_token_id]

        if token_ids_a is None:
          return len(cls + token_ids_a + sep		) * [0]
        return len(cls + token_ids_a + sep		) * [0] + len(token_ids_a + sep		) * [1]







      def 						UpperCamelCase_		(      self				:    Union[str, Any]      , A__				:    str      , A__				:    Optional[str] = None		)   ->					Tuple[str]:
        _snake_case						=							self._tokenizer.model.save(A__      , name=A__		)
        return tuple(A__		)




from ..utils import DummyObject, requires_backends



class   lowercase_   (  metaclass=__lowercase					):
      UpperCamelCase_      :		Optional[int]										=    ["speech"]



      def __init__(      self				:    str      , *A__				:    List[str]      , **A__				:    Tuple		)   ->					Optional[Any]:
        requires_backends(self      , ['''speech''']		)



class   lowercase_   (  metaclass=__lowercase					):
      UpperCamelCase_      :		Optional[Any]										=    ["speech"]



      def __init__(      self				:    Dict      , *A__				:    int      , **A__				:    int		)   ->					Tuple:
        requires_backends(self      , ['''speech''']		)

