




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


a__		    =    logging.get_logger(__name__)

a__		    =    {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

a__		    =    {
    '''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'''
        ),
    },
}

a__		    =    {
    '''microsoft/layoutlm-base-uncased''': 512,
    '''microsoft/layoutlm-large-uncased''': 512,
}

a__		    =    {
    '''microsoft/layoutlm-base-uncased''': {'''do_lower_case''': True},
    '''microsoft/layoutlm-large-uncased''': {'''do_lower_case''': True},
}


class       SCREAMING_SNAKE_CASE_							(					_UpperCamelCase      ):



	"""simple docstring"""


	__magic_name__      :					Union[str, Any]			  =		VOCAB_FILES_NAMES
	__magic_name__      :					int			  =		PRETRAINED_VOCAB_FILES_MAP
	__magic_name__      :					Tuple			  =		PRETRAINED_INIT_CONFIGURATION
	__magic_name__      :					Optional[int]			  =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	__magic_name__      :					str			  =		LayoutLMTokenizer






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







						"""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				:  Any								=			json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
						if (
						    normalizer_state.get("""lowercase"""				,    lowerCAmelCase  ) != do_lower_case
						    or normalizer_state.get("""strip_accents"""				,    lowerCAmelCase  ) != strip_accents
						    or normalizer_state.get("""handle_chinese_chars"""				,    lowerCAmelCase  ) != tokenize_chinese_chars
						):
											__UpperCamelCase				:  Tuple								=			getattr(lowerCAmelCase				,    normalizer_state.pop("""type"""  )  )
											__UpperCamelCase				:  str								=			do_lower_case
											__UpperCamelCase				:  Tuple								=			strip_accents
											__UpperCamelCase				:  Dict								=			tokenize_chinese_chars
											__UpperCamelCase				:  int								=			normalizer_class(**lowerCAmelCase  )

						__UpperCamelCase				:  Any								=			do_lower_case






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







						"""simple docstring"""







						__UpperCamelCase				:  Optional[int]								=			[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]				,    lowerCAmelCase		:	List[int]				,    lowerCAmelCase		:	Optional[List[int]] = None  )  ->					List[int]:







						"""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		:	List[str]				,    lowerCAmelCase		:	str				,    lowerCAmelCase		:	Optional[str] = None  )  ->					Tuple[str]:







						"""simple docstring"""







						__UpperCamelCase				:  List[Any]								=			self._tokenizer.model.save(lowerCAmelCase				,    name=lowerCAmelCase  )
						return tuple(lowerCAmelCase  )












a__		    =    {
    "kilogram": 1,
    "gram": pow(10, 3),
    "milligram": pow(10, 6),
    "metric-ton": pow(10, -3),
    "long-ton": 0.00_0984_2073,
    "short-ton": 0.00_1102_3122,
    "pound": 2.20_4624_4202,
    "stone": 0.15_7473_1728,
    "ounce": 35.2_7399_0723,
    "carrat": 5000,
    "atomic-mass-unit": 6.0_2213_6652e26,
}

a__		    =    {
    "kilogram": 1,
    "gram": pow(10, -3),
    "milligram": pow(10, -6),
    "metric-ton": pow(10, 3),
    "long-ton": 1016.0_4608,
    "short-ton": 907.184,
    "pound": 0.45_3592,
    "stone": 6.3_5029,
    "ounce": 0.028_3495,
    "carrat": 0.0002,
    "atomic-mass-unit": 1.6_6054_0199e-27,
}





def 							A__   (snake_case      :		str		,  snake_case      :		str		,  snake_case      :		float							)    ->	float:
					if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
										__UpperCamelCase				:  Any								=			(
										    F'''Invalid \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
										    F'''Supported values are: {", ".join(snake_case							)}'''
										)
										raise ValueError(snake_case							)
					return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
	import doctest

	doctest.testmod()






