






import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_layoutlm import LayoutLMTokenizer


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

__UpperCamelCase   :						List[str]							=  {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

__UpperCamelCase   :						Optional[int]							=  {
    """vocab_file""": {
        """microsoft/layoutlm-base-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt"""
        ),
        """microsoft/layoutlm-large-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """microsoft/layoutlm-base-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/tokenizer.json"""
        ),
        """microsoft/layoutlm-large-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

__UpperCamelCase   :						Union[str, Any]							=  {
    """microsoft/layoutlm-base-uncased""": 512,
    """microsoft/layoutlm-large-uncased""": 512,
}

__UpperCamelCase   :						Any							=  {
    """microsoft/layoutlm-base-uncased""": {"""do_lower_case""": True},
    """microsoft/layoutlm-large-uncased""": {"""do_lower_case""": True},
}


class 					__SCREAMING_SNAKE_CASE(		a_		):
							_UpperCAmelCase	      =    VOCAB_FILES_NAMES
							_UpperCAmelCase	      =    PRETRAINED_VOCAB_FILES_MAP
							_UpperCAmelCase	      =    PRETRAINED_INIT_CONFIGURATION
							_UpperCAmelCase	      =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							_UpperCAmelCase	      =    LayoutLMTokenizer
							def __init__(       self: int    ,		UpperCamelCase: str=None    ,		UpperCamelCase: Optional[int]=None    ,		UpperCamelCase: Union[str, Any]=True    ,		UpperCamelCase: str="[UNK]"    ,		UpperCamelCase: Dict="[SEP]"    ,		UpperCamelCase: List[str]="[PAD]"    ,		UpperCamelCase: List[str]="[CLS]"    ,		UpperCamelCase: int="[MASK]"    ,		UpperCamelCase: Union[str, Any]=True    ,		UpperCamelCase: Union[str, Any]=None    ,		**UpperCamelCase: List[Any]    ,		)						->						Any:
											super().__init__(
											    UpperCamelCase    ,		tokenizer_file=UpperCamelCase    ,		do_lower_case=UpperCamelCase    ,		unk_token=UpperCamelCase    ,		sep_token=UpperCamelCase    ,		pad_token=UpperCamelCase    ,		cls_token=UpperCamelCase    ,		mask_token=UpperCamelCase    ,		tokenize_chinese_chars=UpperCamelCase    ,		strip_accents=UpperCamelCase    ,		**UpperCamelCase    ,		)

											snake_case__													=       json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
											if (
											    normalizer_state.get('lowercase'    ,		UpperCamelCase  ) != do_lower_case
											    or normalizer_state.get('strip_accents'    ,		UpperCamelCase  ) != strip_accents
											    or normalizer_state.get('handle_chinese_chars'    ,		UpperCamelCase  ) != tokenize_chinese_chars
											):
															snake_case__													=       getattr(UpperCamelCase    ,		normalizer_state.pop('type'  )  )
															snake_case__													=       do_lower_case
															snake_case__													=       strip_accents
															snake_case__													=       tokenize_chinese_chars
															snake_case__													=       normalizer_class(**UpperCamelCase  )

											snake_case__													=       do_lower_case
							def lowerCAmelCase_	(       self: Dict    ,		UpperCamelCase: Optional[Any]    ,		UpperCamelCase: List[Any]=None  )						->						Any:
											snake_case__													=       [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 lowerCAmelCase_	(       self: List[str]    ,		UpperCamelCase: List[int]    ,		UpperCamelCase: 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 lowerCAmelCase_	(       self: List[Any]    ,		UpperCamelCase: str    ,		UpperCamelCase: Optional[str] = None  )						->						Tuple[str]:
											snake_case__													=       self._tokenizer.model.save(UpperCamelCase    ,		name=UpperCamelCase  )
											return tuple(UpperCamelCase  )












def        a_	( _A ,				_A					)     ->     Union[str, Any]:







				"""simple docstring"""
				snake_case__													=       1
				while b > 0:
								if b & 1:
												res *= a

								a *= a
								b >>= 1

				return res
def        a_	( _A ,				_A ,				_A					)     ->     Dict:







				"""simple docstring"""
				snake_case__													=       1
				while b > 0:
								if b & 1:
												snake_case__													=       ((res % c) * (a % c)) % c

								a *= a
								b >>= 1

				return res




