






'''simple docstring'''
import json
import os
import sys
import tempfile
import unittest
from pathlib import Path
from shutil import copyfile

from huggingface_hub import HfFolder, Repository, create_repo, delete_repo
from requests.exceptions import HTTPError

import transformers
from transformers import (
    CONFIG_MAPPING,
    FEATURE_EXTRACTOR_MAPPING,
    PROCESSOR_MAPPING,
    TOKENIZER_MAPPING,
    AutoConfig,
    AutoFeatureExtractor,
    AutoProcessor,
    AutoTokenizer,
    BertTokenizer,
    ProcessorMixin,
    WavaVecaConfig,
    WavaVecaFeatureExtractor,
    WavaVecaProcessor,
)
from transformers.testing_utils import TOKEN, USER, get_tests_dir, is_staging_test
from transformers.tokenization_utils import TOKENIZER_CONFIG_FILE
from transformers.utils import FEATURE_EXTRACTOR_NAME, is_tokenizers_available


sys.path.append(str(Path(__file__).parent.parent.parent.parent / 'utils'))

from test_module.custom_configuration import CustomConfig  # noqa E402
from test_module.custom_feature_extraction import CustomFeatureExtractor  # noqa E402
from test_module.custom_processing import CustomProcessor  # noqa E402
from test_module.custom_tokenization import CustomTokenizer  # noqa E402


a_					= get_tests_dir('fixtures/dummy_feature_extractor_config.json')
a_					= get_tests_dir('fixtures/vocab.json')
a_					= get_tests_dir('fixtures')






class      __SCREAMING_SNAKE_CASE      (			unittest.TestCase				):
 snake_case_  							=							["""[UNK]""", """[CLS]""", """[SEP]""", """[PAD]""", """[MASK]""", """bla""", """blou"""]




 def      __magic_name__	(      self	:							Tuple      )	->						Any:
       SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=0




 def      __magic_name__	(      self	:							List[str]      )	->						Optional[Any]:
       SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=AutoProcessor.from_pretrained('''facebook/wav2vec2-base-960h'''      )
       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							str      )	->						Tuple:
       with tempfile.TemporaryDirectory() as tmpdirname:
             SCREAMING_SNAKE_CASE__     :				int									=WavaVecaConfig()
             SCREAMING_SNAKE_CASE__     :				Tuple									=AutoProcessor.from_pretrained('''facebook/wav2vec2-base-960h'''      )

             # save in new folder
             model_config.save_pretrained(__lowercase      )
             processor.save_pretrained(__lowercase      )

             SCREAMING_SNAKE_CASE__     :				str									=AutoProcessor.from_pretrained(__lowercase      )

       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							Optional[int]      )	->						Dict:
       with tempfile.TemporaryDirectory() as tmpdirname:
             # copy relevant files
             copyfile(__lowercase					,      os.path.join(__lowercase					,      __lowercase      )      )
             copyfile(__lowercase					,      os.path.join(__lowercase					,      '''vocab.json'''      )      )

             SCREAMING_SNAKE_CASE__     :				List[str]									=AutoProcessor.from_pretrained(__lowercase      )

       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							Any      )	->						Tuple:
       with tempfile.TemporaryDirectory() as tmpdirname:
             SCREAMING_SNAKE_CASE__     :				List[str]									=WavaVecaFeatureExtractor()
             SCREAMING_SNAKE_CASE__     :				str									=AutoTokenizer.from_pretrained('''facebook/wav2vec2-base-960h'''      )

             SCREAMING_SNAKE_CASE__     :				List[Any]									=WavaVecaProcessor(__lowercase					,      __lowercase      )

             # save in new folder
             processor.save_pretrained(__lowercase      )

             # drop `processor_class` in tokenizer
             with open(os.path.join(__lowercase					,      __lowercase      )					,      '''r'''      ) as f:
                   SCREAMING_SNAKE_CASE__     :				str									=json.load(__lowercase      )
                   config_dict.pop('''processor_class'''      )

             with open(os.path.join(__lowercase					,      __lowercase      )					,      '''w'''      ) as f:
                   f.write(json.dumps(__lowercase      )      )

             SCREAMING_SNAKE_CASE__     :				Optional[int]									=AutoProcessor.from_pretrained(__lowercase      )

       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							Tuple      )	->						Optional[Any]:
       with tempfile.TemporaryDirectory() as tmpdirname:
             SCREAMING_SNAKE_CASE__     :				Tuple									=WavaVecaFeatureExtractor()
             SCREAMING_SNAKE_CASE__     :				int									=AutoTokenizer.from_pretrained('''facebook/wav2vec2-base-960h'''      )

             SCREAMING_SNAKE_CASE__     :				int									=WavaVecaProcessor(__lowercase					,      __lowercase      )

             # save in new folder
             processor.save_pretrained(__lowercase      )

             # drop `processor_class` in feature extractor
             with open(os.path.join(__lowercase					,      __lowercase      )					,      '''r'''      ) as f:
                   SCREAMING_SNAKE_CASE__     :				List[Any]									=json.load(__lowercase      )
                   config_dict.pop('''processor_class'''      )

             with open(os.path.join(__lowercase					,      __lowercase      )					,      '''w'''      ) as f:
                   f.write(json.dumps(__lowercase      )      )

             SCREAMING_SNAKE_CASE__     :				Tuple									=AutoProcessor.from_pretrained(__lowercase      )

       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							Optional[Any]      )	->						int:
       with tempfile.TemporaryDirectory() as tmpdirname:
             SCREAMING_SNAKE_CASE__     :				int									=WavaVecaConfig(processor_class='''Wav2Vec2Processor'''      )
             model_config.save_pretrained(__lowercase      )
             # copy relevant files
             copyfile(__lowercase					,      os.path.join(__lowercase					,      '''vocab.json'''      )      )
             # create emtpy sample processor
             with open(os.path.join(__lowercase					,      __lowercase      )					,      '''w'''      ) as f:
                   f.write('''{}'''      )

             SCREAMING_SNAKE_CASE__     :				str									=AutoProcessor.from_pretrained(__lowercase      )

       self.assertIsInstance(__lowercase					,      __lowercase      )




 def      __magic_name__	(      self	:							Union[str, Any]      )	->						Tuple:
       # If remote code is not set, we will time out when asking whether to load the model.
       with self.assertRaises(__lowercase      ):
             SCREAMING_SNAKE_CASE__     :				List[str]									=AutoProcessor.from_pretrained('''hf-internal-testing/test_dynamic_processor'''      )
       # If remote code is disabled, we can't load this config.
       with self.assertRaises(__lowercase      ):
             SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=AutoProcessor.from_pretrained(
                 '''hf-internal-testing/test_dynamic_processor'''					,      trust_remote_code=__lowercase      )

       SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=AutoProcessor.from_pretrained('''hf-internal-testing/test_dynamic_processor'''					,      trust_remote_code=__lowercase      )
       self.assertTrue(processor.special_attribute_present      )
       self.assertEqual(processor.__class__.__name__					,      '''NewProcessor'''      )

       SCREAMING_SNAKE_CASE__     :				Optional[int]									=processor.feature_extractor
       self.assertTrue(feature_extractor.special_attribute_present      )
       self.assertEqual(feature_extractor.__class__.__name__					,      '''NewFeatureExtractor'''      )

       SCREAMING_SNAKE_CASE__     :				Dict									=processor.tokenizer
       self.assertTrue(tokenizer.special_attribute_present      )
       if is_tokenizers_available():
             self.assertEqual(tokenizer.__class__.__name__					,      '''NewTokenizerFast'''      )

             # Test we can also load the slow version
             SCREAMING_SNAKE_CASE__     :				List[str]									=AutoProcessor.from_pretrained(
                 '''hf-internal-testing/test_dynamic_processor'''					,      trust_remote_code=__lowercase					,      use_fast=__lowercase      )
             SCREAMING_SNAKE_CASE__     :				Optional[Any]									=new_processor.tokenizer
             self.assertTrue(new_tokenizer.special_attribute_present      )
             self.assertEqual(new_tokenizer.__class__.__name__					,      '''NewTokenizer'''      )
       else:
             self.assertEqual(tokenizer.__class__.__name__					,      '''NewTokenizer'''      )




 def      __magic_name__	(      self	:							str      )	->						Union[str, Any]:
       try:
             AutoConfig.register('''custom'''					,      __lowercase      )
             AutoFeatureExtractor.register(__lowercase					,      __lowercase      )
             AutoTokenizer.register(__lowercase					,      slow_tokenizer_class=__lowercase      )
             AutoProcessor.register(__lowercase					,      __lowercase      )
             # Trying to register something existing in the Transformers library will raise an error
             with self.assertRaises(__lowercase      ):
                   AutoProcessor.register(__lowercase					,      __lowercase      )

             # Now that the config is registered, it can be used as any other config with the auto-API
             SCREAMING_SNAKE_CASE__     :				Any									=CustomFeatureExtractor.from_pretrained(__lowercase      )

             with tempfile.TemporaryDirectory() as tmp_dir:
                   SCREAMING_SNAKE_CASE__     :				Any									=os.path.join(__lowercase					,      '''vocab.txt'''      )
                   with open(__lowercase					,      '''w'''					,      encoding='''utf-8'''      ) as vocab_writer:
                         vocab_writer.write(''''''.join([x + '''\n''' for x in self.vocab_tokens]      )      )
                   SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=CustomTokenizer(__lowercase      )

             SCREAMING_SNAKE_CASE__     :				Dict									=CustomProcessor(__lowercase					,      __lowercase      )

             with tempfile.TemporaryDirectory() as tmp_dir:
                   processor.save_pretrained(__lowercase      )
                   SCREAMING_SNAKE_CASE__     :				List[Any]									=AutoProcessor.from_pretrained(__lowercase      )
                   self.assertIsInstance(__lowercase					,      __lowercase      )

       finally:
             if "custom" in CONFIG_MAPPING._extra_content:
                   del CONFIG_MAPPING._extra_content["custom"]
             if CustomConfig in FEATURE_EXTRACTOR_MAPPING._extra_content:
                   del FEATURE_EXTRACTOR_MAPPING._extra_content[CustomConfig]
             if CustomConfig in TOKENIZER_MAPPING._extra_content:
                   del TOKENIZER_MAPPING._extra_content[CustomConfig]
             if CustomConfig in PROCESSOR_MAPPING._extra_content:
                   del PROCESSOR_MAPPING._extra_content[CustomConfig]




 def      __magic_name__	(      self	:							str      )	->						Dict:






       class      __SCREAMING_SNAKE_CASE      (			lowerCamelCase				):
        snake_case_  							=							False






       class      __SCREAMING_SNAKE_CASE      (			lowerCamelCase				):
        snake_case_  							=							False






       class      __SCREAMING_SNAKE_CASE      (			lowerCamelCase				):
        snake_case_  							=							"""AutoFeatureExtractor"""
        snake_case_  							=							"""AutoTokenizer"""
        snake_case_  							=							False

       try:
             AutoConfig.register('''custom'''					,      __lowercase      )
             AutoFeatureExtractor.register(__lowercase					,      __lowercase      )
             AutoTokenizer.register(__lowercase					,      slow_tokenizer_class=__lowercase      )
             AutoProcessor.register(__lowercase					,      __lowercase      )
             # If remote code is not set, the default is to use local classes.
             SCREAMING_SNAKE_CASE__     :				Tuple									=AutoProcessor.from_pretrained('''hf-internal-testing/test_dynamic_processor'''      )
             self.assertEqual(processor.__class__.__name__					,      '''NewProcessor'''      )
             self.assertFalse(processor.special_attribute_present      )
             self.assertFalse(processor.feature_extractor.special_attribute_present      )
             self.assertFalse(processor.tokenizer.special_attribute_present      )

             # If remote code is disabled, we load the local ones.
             SCREAMING_SNAKE_CASE__     :				Any									=AutoProcessor.from_pretrained(
                 '''hf-internal-testing/test_dynamic_processor'''					,      trust_remote_code=__lowercase      )
             self.assertEqual(processor.__class__.__name__					,      '''NewProcessor'''      )
             self.assertFalse(processor.special_attribute_present      )
             self.assertFalse(processor.feature_extractor.special_attribute_present      )
             self.assertFalse(processor.tokenizer.special_attribute_present      )

             # If remote is enabled, we load from the Hub.
             SCREAMING_SNAKE_CASE__     :				str									=AutoProcessor.from_pretrained(
                 '''hf-internal-testing/test_dynamic_processor'''					,      trust_remote_code=__lowercase      )
             self.assertEqual(processor.__class__.__name__					,      '''NewProcessor'''      )
             self.assertTrue(processor.special_attribute_present      )
             self.assertTrue(processor.feature_extractor.special_attribute_present      )
             self.assertTrue(processor.tokenizer.special_attribute_present      )

       finally:
             if "custom" in CONFIG_MAPPING._extra_content:
                   del CONFIG_MAPPING._extra_content["custom"]
             if CustomConfig in FEATURE_EXTRACTOR_MAPPING._extra_content:
                   del FEATURE_EXTRACTOR_MAPPING._extra_content[CustomConfig]
             if CustomConfig in TOKENIZER_MAPPING._extra_content:
                   del TOKENIZER_MAPPING._extra_content[CustomConfig]
             if CustomConfig in PROCESSOR_MAPPING._extra_content:
                   del PROCESSOR_MAPPING._extra_content[CustomConfig]




 def      __magic_name__	(      self	:							List[Any]      )	->						int:
       SCREAMING_SNAKE_CASE__     :				Optional[int]									=AutoProcessor.from_pretrained('''hf-internal-testing/tiny-random-bert'''      )
       self.assertEqual(processor.__class__.__name__					,      '''BertTokenizerFast'''      )




 def      __magic_name__	(      self	:							List[Any]      )	->						Union[str, Any]:
       SCREAMING_SNAKE_CASE__     :				List[str]									=AutoProcessor.from_pretrained('''hf-internal-testing/tiny-random-convnext'''      )
       self.assertEqual(processor.__class__.__name__					,      '''ConvNextImageProcessor'''      )






@is_staging_test
class      __SCREAMING_SNAKE_CASE      (			unittest.TestCase				):
 snake_case_  							=							["""[UNK]""", """[CLS]""", """[SEP]""", """[PAD]""", """[MASK]""", """bla""", """blou"""]




 @classmethod
 def      __magic_name__	(      cls	:							str      )	->						Optional[int]:
       SCREAMING_SNAKE_CASE__     :				Optional[int]									=TOKEN
       HfFolder.save_token(__lowercase      )




 @classmethod
 def      __magic_name__	(      cls	:							List[str]      )	->						Optional[Any]:
       try:
             delete_repo(token=cls._token					,      repo_id='''test-processor'''      )
       except HTTPError:
             pass

       try:
             delete_repo(token=cls._token					,      repo_id='''valid_org/test-processor-org'''      )
       except HTTPError:
             pass

       try:
             delete_repo(token=cls._token					,      repo_id='''test-dynamic-processor'''      )
       except HTTPError:
             pass




 def      __magic_name__	(      self	:							int      )	->						str:
       SCREAMING_SNAKE_CASE__     :				Any									=WavaVecaProcessor.from_pretrained(__lowercase      )
       with tempfile.TemporaryDirectory() as tmp_dir:
             processor.save_pretrained(
                 os.path.join(__lowercase					,      '''test-processor'''      )					,      push_to_hub=__lowercase					,      use_auth_token=self._token      )

             SCREAMING_SNAKE_CASE__     :				int									=WavaVecaProcessor.from_pretrained(F"{USER}/test-processor"      )
             for k, v in processor.feature_extractor.__dict__.items():
                   self.assertEqual(__lowercase					,      getattr(new_processor.feature_extractor					,      __lowercase      )      )
             self.assertDictEqual(new_processor.tokenizer.get_vocab()					,      processor.tokenizer.get_vocab()      )




 def      __magic_name__	(      self	:							Tuple      )	->						Any:
       SCREAMING_SNAKE_CASE__     :				Any									=WavaVecaProcessor.from_pretrained(__lowercase      )

       with tempfile.TemporaryDirectory() as tmp_dir:
             processor.save_pretrained(
                 os.path.join(__lowercase					,      '''test-processor-org'''      )					,      push_to_hub=__lowercase					,      use_auth_token=self._token					,      organization='''valid_org'''					,      )

             SCREAMING_SNAKE_CASE__     :				Any									=WavaVecaProcessor.from_pretrained('''valid_org/test-processor-org'''      )
             for k, v in processor.feature_extractor.__dict__.items():
                   self.assertEqual(__lowercase					,      getattr(new_processor.feature_extractor					,      __lowercase      )      )
             self.assertDictEqual(new_processor.tokenizer.get_vocab()					,      processor.tokenizer.get_vocab()      )




 def      __magic_name__	(      self	:							Union[str, Any]      )	->						Dict:
       CustomFeatureExtractor.register_for_auto_class()
       CustomTokenizer.register_for_auto_class()
       CustomProcessor.register_for_auto_class()

       SCREAMING_SNAKE_CASE__     :				Any									=CustomFeatureExtractor.from_pretrained(__lowercase      )

       with tempfile.TemporaryDirectory() as tmp_dir:
             SCREAMING_SNAKE_CASE__     :				List[str]									=os.path.join(__lowercase					,      '''vocab.txt'''      )
             with open(__lowercase					,      '''w'''					,      encoding='''utf-8'''      ) as vocab_writer:
                   vocab_writer.write(''''''.join([x + '''\n''' for x in self.vocab_tokens]      )      )
             SCREAMING_SNAKE_CASE__     :				str									=CustomTokenizer(__lowercase      )

       SCREAMING_SNAKE_CASE__     :				int									=CustomProcessor(__lowercase					,      __lowercase      )

       with tempfile.TemporaryDirectory() as tmp_dir:
             create_repo(F"{USER}/test-dynamic-processor"					,      token=self._token      )
             SCREAMING_SNAKE_CASE__     :				List[str]									=Repository(__lowercase					,      clone_from=F"{USER}/test-dynamic-processor"					,      token=self._token      )
             processor.save_pretrained(__lowercase      )

             # This has added the proper auto_map field to the feature extractor config
             self.assertDictEqual(
                 processor.feature_extractor.auto_map					,      {
                     '''AutoFeatureExtractor''': '''custom_feature_extraction.CustomFeatureExtractor''',
                     '''AutoProcessor''': '''custom_processing.CustomProcessor''',
                 }					,      )

             # This has added the proper auto_map field to the tokenizer config
             with open(os.path.join(__lowercase					,      '''tokenizer_config.json'''      )      ) as f:
                   SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=json.load(__lowercase      )
             self.assertDictEqual(
                 tokenizer_config['''auto_map''']					,      {
                     '''AutoTokenizer''': ['''custom_tokenization.CustomTokenizer''', None],
                     '''AutoProcessor''': '''custom_processing.CustomProcessor''',
                 }					,      )

             # The code has been copied from fixtures
             self.assertTrue(os.path.isfile(os.path.join(__lowercase					,      '''custom_feature_extraction.py'''      )      )      )
             self.assertTrue(os.path.isfile(os.path.join(__lowercase					,      '''custom_tokenization.py'''      )      )      )
             self.assertTrue(os.path.isfile(os.path.join(__lowercase					,      '''custom_processing.py'''      )      )      )

             repo.push_to_hub()

       SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=AutoProcessor.from_pretrained(F"{USER}/test-dynamic-processor"					,      trust_remote_code=__lowercase      )
       # Can't make an isinstance check because the new_processor is from the CustomProcessor class of a dynamic module
       self.assertEqual(new_processor.__class__.__name__					,      '''CustomProcessor'''      )







'''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_bert import BertTokenizer


a_					= logging.get_logger(__name__)

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

a_					= {
    'vocab_file': {
        'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt',
        'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt',
        'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/vocab.txt',
        'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/vocab.txt',
        'bert-base-multilingual-uncased': (
            'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/vocab.txt'
        ),
        'bert-base-multilingual-cased': 'https://huggingface.co/bert-base-multilingual-cased/resolve/main/vocab.txt',
        'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/vocab.txt',
        'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/vocab.txt',
        'bert-large-uncased-whole-word-masking': (
            'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt'
        ),
        'bert-large-cased-whole-word-masking': (
            'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/vocab.txt'
        ),
        'bert-large-uncased-whole-word-masking-finetuned-squad': (
            'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt'
        ),
        'bert-large-cased-whole-word-masking-finetuned-squad': (
            'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt'
        ),
        'bert-base-cased-finetuned-mrpc': (
            'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt'
        ),
        'bert-base-german-dbmdz-cased': 'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/vocab.txt',
        'bert-base-german-dbmdz-uncased': (
            'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt'
        ),
        'TurkuNLP/bert-base-finnish-cased-v1': (
            'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt'
        ),
        'TurkuNLP/bert-base-finnish-uncased-v1': (
            'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt'
        ),
        'wietsedv/bert-base-dutch-cased': (
            'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt'
        ),
    },
    'tokenizer_file': {
        'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/tokenizer.json',
        'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json',
        'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json',
        'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/tokenizer.json',
        'bert-base-multilingual-uncased': (
            'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/tokenizer.json'
        ),
        'bert-base-multilingual-cased': (
            'https://huggingface.co/bert-base-multilingual-cased/resolve/main/tokenizer.json'
        ),
        'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/tokenizer.json',
        'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/tokenizer.json',
        'bert-large-uncased-whole-word-masking': (
            'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json'
        ),
        'bert-large-cased-whole-word-masking': (
            'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json'
        ),
        'bert-large-uncased-whole-word-masking-finetuned-squad': (
            'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json'
        ),
        'bert-large-cased-whole-word-masking-finetuned-squad': (
            'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json'
        ),
        'bert-base-cased-finetuned-mrpc': (
            'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json'
        ),
        'bert-base-german-dbmdz-cased': (
            'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json'
        ),
        'bert-base-german-dbmdz-uncased': (
            'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json'
        ),
        'TurkuNLP/bert-base-finnish-cased-v1': (
            'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json'
        ),
        'TurkuNLP/bert-base-finnish-uncased-v1': (
            'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json'
        ),
        'wietsedv/bert-base-dutch-cased': (
            'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json'
        ),
    },
}

a_					= {
    'bert-base-uncased': 5_1_2,
    'bert-large-uncased': 5_1_2,
    'bert-base-cased': 5_1_2,
    'bert-large-cased': 5_1_2,
    'bert-base-multilingual-uncased': 5_1_2,
    'bert-base-multilingual-cased': 5_1_2,
    'bert-base-chinese': 5_1_2,
    'bert-base-german-cased': 5_1_2,
    'bert-large-uncased-whole-word-masking': 5_1_2,
    'bert-large-cased-whole-word-masking': 5_1_2,
    'bert-large-uncased-whole-word-masking-finetuned-squad': 5_1_2,
    'bert-large-cased-whole-word-masking-finetuned-squad': 5_1_2,
    'bert-base-cased-finetuned-mrpc': 5_1_2,
    'bert-base-german-dbmdz-cased': 5_1_2,
    'bert-base-german-dbmdz-uncased': 5_1_2,
    'TurkuNLP/bert-base-finnish-cased-v1': 5_1_2,
    'TurkuNLP/bert-base-finnish-uncased-v1': 5_1_2,
    'wietsedv/bert-base-dutch-cased': 5_1_2,
}

a_					= {
    'bert-base-uncased': {'do_lower_case': True},
    'bert-large-uncased': {'do_lower_case': True},
    'bert-base-cased': {'do_lower_case': False},
    'bert-large-cased': {'do_lower_case': False},
    'bert-base-multilingual-uncased': {'do_lower_case': True},
    'bert-base-multilingual-cased': {'do_lower_case': False},
    'bert-base-chinese': {'do_lower_case': False},
    'bert-base-german-cased': {'do_lower_case': False},
    'bert-large-uncased-whole-word-masking': {'do_lower_case': True},
    'bert-large-cased-whole-word-masking': {'do_lower_case': False},
    'bert-large-uncased-whole-word-masking-finetuned-squad': {'do_lower_case': True},
    'bert-large-cased-whole-word-masking-finetuned-squad': {'do_lower_case': False},
    'bert-base-cased-finetuned-mrpc': {'do_lower_case': False},
    'bert-base-german-dbmdz-cased': {'do_lower_case': False},
    'bert-base-german-dbmdz-uncased': {'do_lower_case': True},
    'TurkuNLP/bert-base-finnish-cased-v1': {'do_lower_case': False},
    'TurkuNLP/bert-base-finnish-uncased-v1': {'do_lower_case': True},
    'wietsedv/bert-base-dutch-cased': {'do_lower_case': False},
}






class      __SCREAMING_SNAKE_CASE      (			lowerCamelCase				):
 snake_case_  							=							VOCAB_FILES_NAMES
 snake_case_  							=							PRETRAINED_VOCAB_FILES_MAP
 snake_case_  							=							PRETRAINED_INIT_CONFIGURATION
 snake_case_  							=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 snake_case_  							=							BertTokenizer




 def __init__(      self	:							int					,      __lowercase	:							Union[str, Any]=None					,      __lowercase	:							Tuple=None					,      __lowercase	:							str=True					,      __lowercase	:							Optional[Any]="[UNK]"					,      __lowercase	:							Tuple="[SEP]"					,      __lowercase	:							Any="[PAD]"					,      __lowercase	:							List[Any]="[CLS]"					,      __lowercase	:							Union[str, Any]="[MASK]"					,      __lowercase	:							Tuple=True					,      __lowercase	:							str=None					,      **__lowercase	:							Any					,      )	->						Optional[Any]:
       super().__init__(
           __lowercase					,      tokenizer_file=__lowercase					,      do_lower_case=__lowercase					,      unk_token=__lowercase					,      sep_token=__lowercase					,      pad_token=__lowercase					,      cls_token=__lowercase					,      mask_token=__lowercase					,      tokenize_chinese_chars=__lowercase					,      strip_accents=__lowercase					,      **__lowercase					,      )

       SCREAMING_SNAKE_CASE__     :				str									=json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
       if (
           normalizer_state.get('''lowercase'''					,      __lowercase      ) != do_lower_case
           or normalizer_state.get('''strip_accents'''					,      __lowercase      ) != strip_accents
           or normalizer_state.get('''handle_chinese_chars'''					,      __lowercase      ) != tokenize_chinese_chars
       ):
             SCREAMING_SNAKE_CASE__     :				int									=getattr(__lowercase					,      normalizer_state.pop('''type'''      )      )
             SCREAMING_SNAKE_CASE__     :				Any									=do_lower_case
             SCREAMING_SNAKE_CASE__     :				Any									=strip_accents
             SCREAMING_SNAKE_CASE__     :				Dict									=tokenize_chinese_chars
             SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=normalizer_class(**__lowercase      )

       SCREAMING_SNAKE_CASE__     :				Optional[int]									=do_lower_case




 def      __magic_name__	(      self	:							int					,      __lowercase	:							Optional[Any]					,      __lowercase	:							Union[str, Any]=None      )	->						int:
       SCREAMING_SNAKE_CASE__     :				Optional[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      __magic_name__	(      self	:							Union[str, Any]					,      __lowercase	:							List[int]					,      __lowercase	:							Optional[List[int]] = None      )	->						List[int]:
       SCREAMING_SNAKE_CASE__     :				List[str]									=[self.sep_token_id]
       SCREAMING_SNAKE_CASE__     :				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      __magic_name__	(      self	:							List[Any]					,      __lowercase	:							str					,      __lowercase	:							Optional[str] = None      )	->						Tuple[str]:
       SCREAMING_SNAKE_CASE__     :				Optional[int]									=self._tokenizer.model.save(__lowercase					,      name=__lowercase      )
       return tuple(__lowercase      )