



"""simple docstring"""






import json
from typing import Iterator, List, Union

from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers
from tokenizers.implementations.base_tokenizer import BaseTokenizer
from tokenizers.models import Unigram
from tokenizers.processors import TemplateProcessing

class 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





					def __init__(	self							:  Any,  lowerCamelCase							:  str = "▁",  lowerCamelCase							:  bool = True,  lowerCamelCase							:  Union[str, AddedToken] = "<unk>",  lowerCamelCase							:  Union[str, AddedToken] = "</s>",  lowerCamelCase							:  Union[str, AddedToken] = "<pad>",  )-> Tuple:
								lowerCamelCase__		:		Tuple		     ={
								    '''pad''': {'''id''': 0, '''token''': pad_token},
								    '''eos''': {'''id''': 1, '''token''': eos_token},
								    '''unk''': {'''id''': 2, '''token''': unk_token},
								}

								lowerCamelCase__		:		Dict		     =[None] * len(self.special_tokens					)
								for token_dict in self.special_tokens.values():
											lowerCamelCase__		:		Optional[int]		     =token_dict['''token''']

								lowerCamelCase__		:		Optional[Any]		     =Tokenizer(Unigram()					)

								lowerCamelCase__		:		List[Any]		     =normalizers.Sequence(
								    [
								        normalizers.Nmt(),
								        normalizers.NFKC(),
								        normalizers.Replace(Regex(''' {2,}'''					),  ''' '''					),
								        normalizers.Lowercase(),
								    ]					)
								lowerCamelCase__		:		str		     =pre_tokenizers.Sequence(
								    [
								        pre_tokenizers.Metaspace(replacement=lowerCamelCase,  add_prefix_space=lowerCamelCase					),
								        pre_tokenizers.Digits(individual_digits=lowerCamelCase					),
								        pre_tokenizers.Punctuation(),
								    ]					)
								lowerCamelCase__		:		Any		     =decoders.Metaspace(replacement=lowerCamelCase,  add_prefix_space=lowerCamelCase					)

								lowerCamelCase__		:		Tuple		     =TemplateProcessing(
								    single=F'''$A {self.special_tokens["eos"]["token"]}''',  special_tokens=[(self.special_tokens['''eos''']['''token'''], self.special_tokens['''eos''']['''id'''])],  )

								lowerCamelCase__		:		Optional[int]		     ={
								    '''model''': '''SentencePieceUnigram''',
								    '''replacement''': replacement,
								    '''add_prefix_space''': add_prefix_space,
								}

								super().__init__(lowerCamelCase,  lowerCamelCase					)



					def 		snake_case	(	self							:  Optional[int],  lowerCamelCase							:  Union[str, List[str]],  lowerCamelCase							:  int = 8000,  lowerCamelCase							:  bool = True,  )-> Any:
								lowerCamelCase__		:		int		     =trainers.UnigramTrainer(
								    vocab_size=lowerCamelCase,  special_tokens=self.special_tokens_list,  show_progress=lowerCamelCase,  )

								if isinstance(lowerCamelCase,  lowerCamelCase					):
											lowerCamelCase__		:		Optional[int]		     =[files]
								self._tokenizer.train(lowerCamelCase,  trainer=lowerCamelCase					)

								self.add_unk_id()



					def 		snake_case	(	self							:  List[Any],  lowerCamelCase							:  Union[Iterator[str], Iterator[Iterator[str]]],  lowerCamelCase							:  int = 8000,  lowerCamelCase							:  bool = True,  )-> Union[str, Any]:
								lowerCamelCase__		:		str		     =trainers.UnigramTrainer(
								    vocab_size=lowerCamelCase,  special_tokens=self.special_tokens_list,  show_progress=lowerCamelCase,  )

								self._tokenizer.train_from_iterator(lowerCamelCase,  trainer=lowerCamelCase					)

								self.add_unk_id()




					def 		snake_case	(	self							:  int					)-> Optional[Any]:
								lowerCamelCase__		:		Any		     =json.loads(self._tokenizer.to_str()					)

								lowerCamelCase__		:		Tuple		     =self.special_tokens['''unk''']['''id''']

								lowerCamelCase__		:		Union[str, Any]		     =Tokenizer.from_str(json.dumps(lowerCamelCase					)					)









"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   int							,		__lowerCamelCase    :   int     ):
			"""simple docstring"""
			return int((input_a, input_a).count(0     ) != 0     )






def 					snake_case__       (		):
			"""simple docstring"""
			assert nand_gate(0							,		0     ) == 1
			assert nand_gate(0							,		1     ) == 1
			assert nand_gate(1							,		0     ) == 1
			assert nand_gate(1							,		1     ) == 0


if __name__ == "__main__":
		print(nand_gate(0, 0))
		print(nand_gate(0, 1))
		print(nand_gate(1, 0))
		print(nand_gate(1, 1))




