



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


UpperCamelCase_										=					logging.get_logger(__name__)

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

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

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

UpperCamelCase_										=					{
    '''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 	_snake_case							(			__a      ):






   '''simple docstring'''






   A__	:      Tuple    =		VOCAB_FILES_NAMES
   A__	:      Optional[int]    =		PRETRAINED_VOCAB_FILES_MAP
   A__	:      List[str]    =		PRETRAINED_INIT_CONFIGURATION
   A__	:      Tuple    =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   A__	:      Union[str, Any]    =		BertTokenizer


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

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

       UpperCAmelCase_			:    str   						= do_lower_case


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






"""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_retribert import RetriBertTokenizer


A_						=				logging.get_logger(__name__)

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

A_						=				{
    '''vocab_file''': {
        '''yjernite/retribert-base-uncased''': (
            '''https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''yjernite/retribert-base-uncased''': (
            '''https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/tokenizer.json'''
        ),
    },
}

A_						=				{
    '''yjernite/retribert-base-uncased''': 5_12,
}


A_						=				{
    '''yjernite/retribert-base-uncased''': {'''do_lower_case''': True},
}






class 					lowercase(     __a ):







 '''simple docstring'''





 lowercase__ 					=					VOCAB_FILES_NAMES
 lowercase__ 					=					PRETRAINED_VOCAB_FILES_MAP
 lowercase__ 					=					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 lowercase__ 					=					PRETRAINED_INIT_CONFIGURATION
 lowercase__ 					=					RetriBertTokenizer
 lowercase__ 					=					["input_ids", "attention_mask"]


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




   '''simple docstring'''



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

   _snake_case							:		List[Any]								=  json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
   if (
       normalizer_state.get("""lowercase""",      a_		) != do_lower_case
       or normalizer_state.get("""strip_accents""",      a_		) != strip_accents
       or normalizer_state.get("""handle_chinese_chars""",      a_		) != tokenize_chinese_chars
   ):
     _snake_case							:		Dict								=  getattr(a_,      normalizer_state.pop("""type"""		)		)
     _snake_case							:		List[Any]								=  do_lower_case
     _snake_case							:		List[str]								=  strip_accents
     _snake_case							:		Tuple								=  tokenize_chinese_chars
     _snake_case							:		Tuple								=  normalizer_class(**a_		)

   _snake_case							:		List[str]								=  do_lower_case


 def  UpperCamelCase_   (				self:		Any,      a_:		str,      a_:		Optional[int]=None		):




   '''simple docstring'''



   _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  UpperCamelCase_   (				self:		List[str],      a_:		List[int],      a_:		Optional[List[int]] = None		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  [self.sep_token_id]
   _snake_case							:		List[str]								=  [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:		Dict,      a_:		str,      a_:		Optional[str] = None		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  self._tokenizer.model.save(a_,      name=a_		)
   return tuple(a_		)


