"""simple docstring"""


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


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

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

lowerCAmelCase_:       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"
        ),
    },
}

lowerCAmelCase_:       List[str]			     =       {
    "microsoft/layoutlm-base-uncased": 5_1_2,
    "microsoft/layoutlm-large-uncased": 5_1_2,
}

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






class  a__     ( _a						):
   snake_case_				=   VOCAB_FILES_NAMES
   snake_case_				=   PRETRAINED_VOCAB_FILES_MAP
   snake_case_				=   PRETRAINED_INIT_CONFIGURATION
   snake_case_				=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   snake_case_				=   LayoutLMTokenizer


   def __init__(  self,					_UpperCAmelCase=None,					_UpperCAmelCase=None,					_UpperCAmelCase=True,					_UpperCAmelCase="[UNK]",					_UpperCAmelCase="[SEP]",					_UpperCAmelCase="[PAD]",					_UpperCAmelCase="[CLS]",					_UpperCAmelCase="[MASK]",					_UpperCAmelCase=True,					_UpperCAmelCase=None,					**_UpperCAmelCase,					):
        '''simple docstring'''



        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,					)

        lowercase__								=				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
        ):
             lowercase__								=				getattr(_UpperCAmelCase,					normalizer_state.pop("type"	)	)
             lowercase__								=				do_lower_case
             lowercase__								=				strip_accents
             lowercase__								=				tokenize_chinese_chars
             lowercase__								=				normalizer_class(**_UpperCAmelCase	)

        lowercase__								=				do_lower_case


   def 						snake_case__						(  self,					_UpperCAmelCase,					_UpperCAmelCase=None	):
        '''simple docstring'''



        lowercase__								=				[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 						snake_case__						(  self,					_UpperCAmelCase,					_UpperCAmelCase = None	):
        '''simple docstring'''



        lowercase__								=				[self.sep_token_id]
        lowercase__								=				[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 						snake_case__						(  self,					_UpperCAmelCase,					_UpperCAmelCase = None	):
        '''simple docstring'''



        lowercase__								=				self._tokenizer.model.save(_UpperCAmelCase,					name=_UpperCAmelCase	)
        return tuple(_UpperCAmelCase	)





"""simple docstring"""


import platform
from argparse import ArgumentParser

import huggingface_hub
import pandas
import pyarrow

from datasets import __version__ as version
from datasets.commands import BaseDatasetsCLICommand







def        __a (		A   ):






     '''simple docstring'''



     return EnvironmentCommand()






class  a__     ( _a						):


   @staticmethod
   def 						snake_case__						(  _UpperCAmelCase	):
        '''simple docstring'''



        lowercase__								=				parser.add_parser("env",					help="Print relevant system environment info."	)
        download_parser.set_defaults(func=_UpperCAmelCase	)


   def 						snake_case__						(  self	):
        '''simple docstring'''



        lowercase__								=				{
            "`datasets` version": version,
            "Platform": platform.platform(),
            "Python version": platform.python_version(),
            "Huggingface_hub version": huggingface_hub.__version__,
            "PyArrow version": pyarrow.__version__,
            "Pandas version": pandas.__version__,
        }

        print("\nCopy-and-paste the text below in your GitHub issue.\n"	)
        print(self.format_dict(_UpperCAmelCase	)	)

        return info


   @staticmethod
   def 						snake_case__						(  _UpperCAmelCase	):
        '''simple docstring'''



        return "\n".join([F'''- {prop}: {val}''' for prop, val in d.items()]	) + "\n"




