


"""simple docstring"""







import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
     from .tokenization_albert import AlbertTokenizer
else:
     lowerCAmelCase__ 							=  None

lowerCAmelCase__ 							=  logging.get_logger(__name__)
lowerCAmelCase__ 							=  {'''vocab_file''': '''spiece.model''', '''tokenizer_file''': '''tokenizer.json'''}

lowerCAmelCase__ 							=  {
    '''vocab_file''': {
        '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/spiece.model''',
        '''albert-large-v1''': '''https://huggingface.co/albert-large-v1/resolve/main/spiece.model''',
        '''albert-xlarge-v1''': '''https://huggingface.co/albert-xlarge-v1/resolve/main/spiece.model''',
        '''albert-xxlarge-v1''': '''https://huggingface.co/albert-xxlarge-v1/resolve/main/spiece.model''',
        '''albert-base-v2''': '''https://huggingface.co/albert-base-v2/resolve/main/spiece.model''',
        '''albert-large-v2''': '''https://huggingface.co/albert-large-v2/resolve/main/spiece.model''',
        '''albert-xlarge-v2''': '''https://huggingface.co/albert-xlarge-v2/resolve/main/spiece.model''',
        '''albert-xxlarge-v2''': '''https://huggingface.co/albert-xxlarge-v2/resolve/main/spiece.model''',
    },
    '''tokenizer_file''': {
        '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/tokenizer.json''',
        '''albert-large-v1''': '''https://huggingface.co/albert-large-v1/resolve/main/tokenizer.json''',
        '''albert-xlarge-v1''': '''https://huggingface.co/albert-xlarge-v1/resolve/main/tokenizer.json''',
        '''albert-xxlarge-v1''': '''https://huggingface.co/albert-xxlarge-v1/resolve/main/tokenizer.json''',
        '''albert-base-v2''': '''https://huggingface.co/albert-base-v2/resolve/main/tokenizer.json''',
        '''albert-large-v2''': '''https://huggingface.co/albert-large-v2/resolve/main/tokenizer.json''',
        '''albert-xlarge-v2''': '''https://huggingface.co/albert-xlarge-v2/resolve/main/tokenizer.json''',
        '''albert-xxlarge-v2''': '''https://huggingface.co/albert-xxlarge-v2/resolve/main/tokenizer.json''',
    },
}

lowerCAmelCase__ 							=  {
    '''albert-base-v1''': 512,
    '''albert-large-v1''': 512,
    '''albert-xlarge-v1''': 512,
    '''albert-xxlarge-v1''': 512,
    '''albert-base-v2''': 512,
    '''albert-large-v2''': 512,
    '''albert-xlarge-v2''': 512,
    '''albert-xxlarge-v2''': 512,
}

lowerCAmelCase__ 							=  '''▁'''


class  SCREAMING_SNAKE_CASE__							(						_UpperCamelCase							):
       """simple docstring"""


       a    :							Tuple  =VOCAB_FILES_NAMES
       a    :							str  =PRETRAINED_VOCAB_FILES_MAP
       a    :							Optional[int]  =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       a    :							Optional[Any]  =AlbertTokenizer

       def __init__(		self						,	snake_case__=None						,	snake_case__=None						,	snake_case__=True						,	snake_case__=True						,	snake_case__=False						,	snake_case__="[CLS]"						,	snake_case__="[SEP]"						,	snake_case__="<unk>"						,	snake_case__="[SEP]"						,	snake_case__="<pad>"						,	snake_case__="[CLS]"						,	snake_case__="[MASK]"						,	**snake_case__						,	):






         """simple docstring"""





         lowerCAmelCase	:	str								=				(
             AddedToken(__a						,	lstrip=__a						,	rstrip=__a						,	normalized=__a		)
             if isinstance(__a						,	__a		)
             else mask_token
         )

         super().__init__(
             __a						,	tokenizer_file=__a						,	do_lower_case=__a						,	remove_space=__a						,	keep_accents=__a						,	bos_token=__a						,	eos_token=__a						,	unk_token=__a						,	sep_token=__a						,	pad_token=__a						,	cls_token=__a						,	mask_token=__a						,	**__a						,	)

         lowerCAmelCase	:	Optional[int]								=				do_lower_case
         lowerCAmelCase	:	Dict								=				remove_space
         lowerCAmelCase	:	List[str]								=				keep_accents
         lowerCAmelCase	:	List[Any]								=				vocab_file
         lowerCAmelCase	:	Optional[Any]								=				False if not self.vocab_file else True

       def 			lowercase__				(		self						,	snake_case__						,	snake_case__ = None		):






         """simple docstring"""





         lowerCAmelCase	:	Any								=				[self.sep_token_id]
         lowerCAmelCase	:	Optional[Any]								=				[self.cls_token_id]
         if token_ids_a is None:
           return cls + token_ids_a + sep
         return cls + token_ids_a + sep + token_ids_a + sep

       def 			lowercase__				(		self						,	snake_case__						,	snake_case__ = None		):






         """simple docstring"""





         lowerCAmelCase	:	Tuple								=				[self.sep_token_id]
         lowerCAmelCase	:	List[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 			lowercase__				(		self						,	snake_case__						,	snake_case__ = None		):






         """simple docstring"""





         if not self.can_save_slow_tokenizer:
           raise ValueError(
               "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
               "tokenizer."		)

         if not os.path.isdir(__a		):
           logger.error(f"""Vocabulary path ({save_directory}) should be a directory"""		)
           return
         lowerCAmelCase	:	Optional[int]								=				os.path.join(
             __a						,	(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]		)

         if os.path.abspath(self.vocab_file		) != os.path.abspath(__a		):
           copyfile(self.vocab_file						,	__a		)

         return (out_vocab_file,)












"""simple docstring"""


import re




def        lowercase__     (       lowercase_      )       ->		bool:




      """simple docstring"""

      _UpperCamelCase   :						List[Any]    =							re.compile(
          r"^(?:0|94|\+94|0{2}94)" r"7(0|1|2|4|5|6|7|8)" r"(-| |)" r"\d{7}$"      )

      return bool(re.search(lowercase_		,lowercase_      )      )


if __name__ == "__main__":
  lowerCamelCase__						= "0094702343221"

  print(is_sri_lankan_phone_number(phone))
