'''simple docstring'''






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""": 514}
__a										=					{}





class     A__							(       __snake_case   ):





   """simple docstring"""





   UpperCamelCase_       :						Any    				=     VOCAB_FILES_NAMES
   UpperCamelCase_       :						Union[str, Any]    				=     PRETRAINED_VOCAB_FILES_MAP
   UpperCamelCase_       :						Union[str, Any]    				=     PRETRAINED_INIT_CONFIGURATION
   UpperCamelCase_       :						int    				=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   UpperCamelCase_       :						str    				=     HerbertTokenizer




   def __init__( self     :		Optional[int]						,     lowerCAmelCase__     :		Union[str, Any]=None						,     lowerCAmelCase__     :		Any=None						,     lowerCAmelCase__     :		Optional[Any]=None						,     lowerCAmelCase__     :		List[str]="<s>"						,     lowerCAmelCase__     :		List[str]="<unk>"						,     lowerCAmelCase__     :		List[Any]="<pad>"						,     lowerCAmelCase__     :		str="<mask>"						,     lowerCAmelCase__     :		Optional[Any]="</s>"						,     **lowerCAmelCase__     :		Any						,     )       ->    Tuple:







      """simple docstring"""




      super().__init__(
          A_						,     A_						,     tokenizer_file=A_						,     cls_token=A_						,     unk_token=A_						,     pad_token=A_						,     mask_token=A_						,     sep_token=A_						,     **A_						,     )




   def 			_lowerCAmelCase		( self     :		Union[str, Any]						,     lowerCAmelCase__     :		Union[str, Any]						,     lowerCAmelCase__     :		List[Any] = None			)       ->    Any:







      """simple docstring"""




      _UpperCAmelCase							:	Optional[int]							=   [self.cls_token_id]
      _UpperCAmelCase							:	List[Any]							=   [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 			_lowerCAmelCase		( self     :		str						,     lowerCAmelCase__     :		Optional[int]						,     lowerCAmelCase__     :		Optional[int] = None						,     lowerCAmelCase__     :		Optional[int] = False			)       ->    Union[str, Any]:







      """simple docstring"""




      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 			_lowerCAmelCase		( self     :		Any						,     lowerCAmelCase__     :		Dict						,     lowerCAmelCase__     :		str = None			)       ->    List[str]:







      """simple docstring"""




      _UpperCAmelCase							:	str							=   [self.sep_token_id]
      _UpperCAmelCase							:	Optional[Any]							=   [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 			_lowerCAmelCase		( self     :		Dict						,     lowerCAmelCase__     :		Tuple						,     lowerCAmelCase__     :		Any = None			)       ->    List[Any]:







      """simple docstring"""




      _UpperCAmelCase							:	Any							=   self._tokenizer.model.save(A_						,     name=A_			)
      return tuple(A_			)






class 					A__   :





      def __init__( self       ,							A_   ):
       '''simple docstring'''




       UpperCamelCase	:					Union[str, Any]       	=   set_counts
       UpperCamelCase	:					int       	=   max(A_   )
       UpperCamelCase	:					Optional[Any]       	=   len(A_   )
       UpperCamelCase	:					Union[str, Any]       	=   [1] * num_sets
       UpperCamelCase	:					Union[str, Any]       	=   list(range(A_   )   )





      def        __UpperCamelCase( self       ,							A_       ,							A_   ):
       '''simple docstring'''




       UpperCamelCase	:					Any       	=   self.get_parent(A_   )
       UpperCamelCase	:					Optional[int]       	=   self.get_parent(A_   )

       if src_parent == dst_parent:
        return False

       if self.ranks[dst_parent] >= self.ranks[src_parent]:
        self.set_counts[dst_parent] += self.set_counts[src_parent]
        UpperCamelCase	:					int       	=   0
        UpperCamelCase	:					Dict       	=   dst_parent
        if self.ranks[dst_parent] == self.ranks[src_parent]:
         self.ranks[dst_parent] += 1
        UpperCamelCase	:					Optional[int]       	=   self.set_counts[dst_parent]
       else:
        self.set_counts[src_parent] += self.set_counts[dst_parent]
        UpperCamelCase	:					Any       	=   0
        UpperCamelCase	:					Optional[int]       	=   src_parent
        UpperCamelCase	:					int       	=   self.set_counts[src_parent]

       UpperCamelCase	:					Any       	=   max(self.max_set       ,							A_   )
       return True





      def        __UpperCamelCase( self       ,							A_   ):
       '''simple docstring'''




       if self.parents[disj_set] == disj_set:
        return disj_set
       UpperCamelCase	:					Optional[int]       	=   self.get_parent(self.parents[disj_set]   )
       return self.parents[disj_set]
