


import json
from typing import List, Optional, Tuple

from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokenization_utils import JiebaPreTokenizer


__UpperCamelCase       :       List[str]						       =				logging.get_logger(__name__)

__UpperCamelCase       :       int						       =				{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

__UpperCamelCase       :       Optional[Any]						       =				{
    "vocab_file": {
        "junnyu/roformer_chinese_small": "https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_base": "https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_char_small": (
            "https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_chinese_char_base": (
            "https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_discriminator": (
            "https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_generator": (
            "https://huggingface.co/junnyu/roformer_small_generator/resolve/main/vocab.txt"
        ),
    }
}

__UpperCamelCase       :       Any						       =				{
    "junnyu/roformer_chinese_small": 1536,
    "junnyu/roformer_chinese_base": 1536,
    "junnyu/roformer_chinese_char_small": 512,
    "junnyu/roformer_chinese_char_base": 512,
    "junnyu/roformer_small_discriminator": 128,
    "junnyu/roformer_small_generator": 128,
}


__UpperCamelCase       :       str						       =				{
    "junnyu/roformer_chinese_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_base": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_base": {"do_lower_case": True},
    "junnyu/roformer_small_discriminator": {"do_lower_case": True},
    "junnyu/roformer_small_generator": {"do_lower_case": True},
}

class       __magic_name__	(     __lowerCAmelCase):
     A:		List[str]			=      VOCAB_FILES_NAMES
     A:		Dict			=      PRETRAINED_VOCAB_FILES_MAP
     A:		Union[str, Any]			=      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     A:		Tuple			=      PRETRAINED_INIT_CONFIGURATION
     A:		int			=      RoFormerTokenizer


     def __init__(      self							:     int							,	lowerCamelCase__							:     Dict=None							,	lowerCamelCase__							:     str=None							,	lowerCamelCase__							:     Dict=True							,	lowerCamelCase__							:     Optional[int]="[UNK]"							,	lowerCamelCase__							:     Tuple="[SEP]"							,	lowerCamelCase__							:     str="[PAD]"							,	lowerCamelCase__							:     Any="[CLS]"							,	lowerCamelCase__							:     List[str]="[MASK]"							,	lowerCamelCase__							:     Optional[Any]=True							,	lowerCamelCase__							:     Optional[int]=None							,	**lowerCamelCase__							:     Optional[int]							,	)  ->      Tuple:





      '''simple docstring'''






      super().__init__(
          lowerCamelCase__							,	tokenizer_file=lowerCamelCase__							,	do_lower_case=lowerCamelCase__							,	unk_token=lowerCamelCase__							,	sep_token=lowerCamelCase__							,	pad_token=lowerCamelCase__							,	cls_token=lowerCamelCase__							,	mask_token=lowerCamelCase__							,	tokenize_chinese_chars=lowerCamelCase__							,	strip_accents=lowerCamelCase__							,	**lowerCamelCase__							,	)

      UpperCamelCase__					:    str          =   json.loads(self.backend_tokenizer.normalizer.__getstate__()			)
      if (
          pre_tok_state.get('''lowercase'''							,	lowerCamelCase__			) != do_lower_case
          or pre_tok_state.get('''strip_accents'''							,	lowerCamelCase__			) != strip_accents
      ):
       UpperCamelCase__					:    Optional[int]          =   getattr(lowerCamelCase__							,	pre_tok_state.pop('''type'''			)			)
       UpperCamelCase__					:    Optional[Any]          =   do_lower_case
       UpperCamelCase__					:    Optional[int]          =   strip_accents
       UpperCamelCase__					:    Union[str, Any]          =   pre_tok_class(**lowerCamelCase__			)

      UpperCamelCase__					:    List[Any]          =   do_lower_case


     def __getstate__(      self							:     List[Any]			)  ->      List[Any]:





      '''simple docstring'''






      UpperCamelCase__					:    int          =   self.__dict__.copy()
      UpperCamelCase__					:    Optional[int]          =   BertPreTokenizer()
      return state


     def __setstate__(      self							:     Union[str, Any]							,	lowerCamelCase__							:     str			)  ->      Any:





      '''simple docstring'''






      UpperCamelCase__					:    Any          =   d
      UpperCamelCase__					:    List[str]          =   self.__dict__['''_tokenizer'''].get_vocab()
      UpperCamelCase__					:    str          =   PreTokenizer.custom(JiebaPreTokenizer(lowerCamelCase__			)			)


     def      UpperCAmelCase__	(      self							:     Optional[int]							,	lowerCamelCase__							:     Any							,	lowerCamelCase__							:     str=None			)  ->      Optional[int]:





      '''simple docstring'''






      UpperCamelCase__					:    Any          =   [self.cls_token_id] + token_ids_a + [self.sep_token_id]

      if token_ids_a:
       output += token_ids_a + [self.sep_token_id]

      return output


     def      UpperCAmelCase__	(      self							:     Optional[Any]							,	lowerCamelCase__							:     List[int]							,	lowerCamelCase__							:     Optional[List[int]] = None			)  ->      List[int]:





      '''simple docstring'''






      UpperCamelCase__					:    List[str]          =   [self.sep_token_id]
      UpperCamelCase__					:    Union[str, 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      UpperCAmelCase__	(      self							:     Tuple							,	lowerCamelCase__							:     str							,	lowerCamelCase__							:     Optional[str] = None			)  ->      Tuple[str]:





      '''simple docstring'''






      UpperCamelCase__					:    Dict          =   self._tokenizer.model.save(lowerCamelCase__							,	name=lowerCamelCase__			)
      return tuple(lowerCamelCase__			)


     def      UpperCAmelCase__	(      self							:     Union[str, Any]							,	lowerCamelCase__							:     int							,	lowerCamelCase__							:     Optional[Any]=None							,	lowerCamelCase__							:     Tuple=None							,	lowerCamelCase__							:     Optional[Any]=False							,	**lowerCamelCase__							:     int							,	)  ->      Optional[int]:





      '''simple docstring'''






      UpperCamelCase__					:    List[str]          =   BertPreTokenizer()
      return super().save_pretrained(lowerCamelCase__							,	lowerCamelCase__							,	lowerCamelCase__							,	lowerCamelCase__							,	**lowerCamelCase__			)






from math import factorial, radians

def 			_a  (				SCREAMING_SNAKE_CASE	:				float    , SCREAMING_SNAKE_CASE	:				int = 18    , SCREAMING_SNAKE_CASE	:				int = 10     ):







 """simple docstring"""



 UpperCamelCase__					:    Dict          =   angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0)

 # Converting from degrees to radians
 UpperCamelCase__					:    int          =   radians(SCREAMING_SNAKE_CASE     )

 UpperCamelCase__					:    Tuple          =   angle_in_radians
 UpperCamelCase__					:    str          =   3
 UpperCamelCase__					:    int          =   -1

 for _ in range(SCREAMING_SNAKE_CASE     ):
  result += (b * (angle_in_radians**a)) / factorial(SCREAMING_SNAKE_CASE     )

  UpperCamelCase__					:    List[Any]          =   -b  # One positive term and the next will be negative and so on...
  a += 2  # Increased by 2 for every term.

 return round(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )


if __name__ == "__main__":
       __import__("doctest").testmod()


