
"""simple docstring"""
import unicodedata
from dataclasses import dataclass
from typing import Optional, Union

import numpy as np

from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase





def      __magic_name__				(							lowercase							,			lowercase							,			lowercase							,			lowercase ):






   if isinstance(_UpperCamelCase							,			_UpperCamelCase ):
      SCREAMING_SNAKE_CASE_: Optional[Any]     			=np.full((len(_UpperCamelCase ), sequence_length, 2)							,			_UpperCamelCase )
   else:
      SCREAMING_SNAKE_CASE_: int     			=np.full((len(_UpperCamelCase ), sequence_length)							,			_UpperCamelCase )

   for i, tensor in enumerate(_UpperCamelCase ):
      if padding_side == "right":
         if isinstance(_UpperCamelCase							,			_UpperCamelCase ):
            SCREAMING_SNAKE_CASE_: Dict     			=tensor[:sequence_length]
         else:
            SCREAMING_SNAKE_CASE_: Optional[Any]     			=tensor[:sequence_length]
      else:
         if isinstance(_UpperCamelCase							,			_UpperCamelCase ):
            SCREAMING_SNAKE_CASE_: List[Any]     			=tensor[:sequence_length]
         else:
            SCREAMING_SNAKE_CASE_: str     			=tensor[:sequence_length]

   return out_tensor.tolist()





def      __magic_name__				(							lowercase ):
   SCREAMING_SNAKE_CASE_: Tuple     			=ord(_UpperCamelCase )
   if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126):
      return True
   SCREAMING_SNAKE_CASE_: Optional[int]     			=unicodedata.category(_UpperCamelCase )
   if cat.startswith("""P""" ):
      return True
   return False
@dataclass
class 					a	(  UpperCAmelCase__       ):
  UpperCamelCase	:				PreTrainedTokenizerBase
  UpperCamelCase	:				Union[bool, str, PaddingStrategy]     						=					True
  UpperCamelCase	:				Optional[int]     						=					None
  UpperCamelCase	:				Optional[int]     						=					None
  UpperCamelCase	:				int     						=					-1_0_0
  UpperCamelCase	:				str     						=					"pt"



  def 	lowerCamelCase__       (						self :					Tuple       ,		lowerCAmelCase :					Any		)     ->					Optional[Any]:


     '''simple docstring'''




     import torch

     SCREAMING_SNAKE_CASE_: Optional[Any]     			="""label""" if """label""" in features[0].keys() else """labels"""
     SCREAMING_SNAKE_CASE_: Union[str, Any]     			=[feature[label_name] for feature in features] if label_name in features[0].keys() else None
     SCREAMING_SNAKE_CASE_: Optional[int]     			=self.tokenizer.pad(
         lowerCAmelCase       ,		padding=self.padding       ,		max_length=self.max_length       ,		pad_to_multiple_of=self.pad_to_multiple_of       ,		return_tensors="""pt""" if labels is None else None       ,		)

     if labels is None:
        return batch

     SCREAMING_SNAKE_CASE_: int     			=torch.tensor(batch["""entity_ids"""]		).shape[1]
     SCREAMING_SNAKE_CASE_: Optional[int]     			=self.tokenizer.padding_side
     if padding_side == "right":
        SCREAMING_SNAKE_CASE_: Tuple     			=[
            list(lowerCAmelCase		) + [self.label_pad_token_id] * (sequence_length - len(lowerCAmelCase		)) for label in labels
        ]
     else:
        SCREAMING_SNAKE_CASE_: Optional[int]     			=[
            [self.label_pad_token_id] * (sequence_length - len(lowerCAmelCase		)) + list(lowerCAmelCase		) for label in labels
        ]

     SCREAMING_SNAKE_CASE_: Optional[Any]     			=[feature["""ner_tags"""] for feature in features]
     SCREAMING_SNAKE_CASE_: Any     			=padding_tensor(lowerCAmelCase       ,		-1       ,		lowerCAmelCase       ,		lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: Optional[int]     			=[feature["""original_entity_spans"""] for feature in features]
     SCREAMING_SNAKE_CASE_: Optional[Any]     			=padding_tensor(lowerCAmelCase       ,		(-1, -1)       ,		lowerCAmelCase       ,		lowerCAmelCase		)
     SCREAMING_SNAKE_CASE_: Optional[int]     			={k: torch.tensor(lowerCAmelCase       ,		dtype=torch.intaa		) for k, v in batch.items()}

     return batch








"""simple docstring"""
def      __magic_name__				(							lowercase ):
   return str(lowercase ) == str(lowercase )[::-1]





def      __magic_name__				(							lowercase ):
   return int(lowercase ) + int(str(lowercase )[::-1] )





def      __magic_name__				(							lowercase = 1_0000 ):
   SCREAMING_SNAKE_CASE_: List[str]     			=[]
   for num in range(1							,			lowercase ):
      SCREAMING_SNAKE_CASE_: List[Any]     			=0
      SCREAMING_SNAKE_CASE_: int     			=num
      while iterations < 50:
         SCREAMING_SNAKE_CASE_: Optional[Any]     			=sum_reverse(lowercase )
         iterations += 1
         if is_palindrome(lowercase ):
            break
      else:
         lychrel_nums.append(lowercase )
   return len(lowercase )


if __name__ == "__main__":
   print(f"""{solution() = }""")



