




import os
import re
import unicodedata
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


_lowerCamelCase			 =						logging.get_logger(__name__)
_lowerCamelCase			 =						{'vocab_file': 'spiece.model'}

_lowerCamelCase			 =						{
    'vocab_file': {
        'google/fnet-base': 'https://huggingface.co/google/fnet-base/resolve/main/spiece.model',
        'google/fnet-large': 'https://huggingface.co/google/fnet-large/resolve/main/spiece.model',
    },
}

_lowerCamelCase			 =						{
    'google/fnet-base': 5_12,
    'google/fnet-large': 5_12,
}

_lowerCamelCase			 =						'▁'



class 			a     (   _A			):

     '''simple docstring'''





     lowerCAmelCase				:       str   		=  VOCAB_FILES_NAMES
     lowerCAmelCase				:       List[Any]   		=  PRETRAINED_VOCAB_FILES_MAP
     lowerCAmelCase				:       Dict   		=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     lowerCAmelCase				:       Dict   		=  ['input_ids', 'token_type_ids']
     def __init__(	self   :			Optional[Any]					,    __snake_case   :			Optional[int]					,    __snake_case   :			List[Any]=False					,    __snake_case   :			Any=True					,    __snake_case   :			List[Any]=True					,    __snake_case   :			List[str]="<unk>"					,    __snake_case   :			Union[str, Any]="[SEP]"					,    __snake_case   :			Optional[Any]="<pad>"					,    __snake_case   :			Any="[CLS]"					,    __snake_case   :			str="[MASK]"					,    __snake_case   :			Optional[Dict[str, Any]] = None					,    **__snake_case   :			List[str]					,    ):
         # Mask token behave like a normal word, i.e. include the space before it and
         # is included in the raw text, there should be a match in a non-normalized sentence.
         UpperCAmelCase_							 =     (
             AddedToken(__snake_case					,    lstrip=__snake_case					,    rstrip=__snake_case					,    normalized=__snake_case				)
             if isinstance(__snake_case					,    __snake_case				)
             else mask_token
         )

         UpperCAmelCase_							 =     {} if sp_model_kwargs is None else sp_model_kwargs

         super().__init__(
             do_lower_case=__snake_case					,    remove_space=__snake_case					,    keep_accents=__snake_case					,    unk_token=__snake_case					,    sep_token=__snake_case					,    pad_token=__snake_case					,    cls_token=__snake_case					,    mask_token=__snake_case					,    sp_model_kwargs=self.sp_model_kwargs					,    **__snake_case					,    )

         UpperCAmelCase_							 =     do_lower_case
         UpperCAmelCase_							 =     remove_space
         UpperCAmelCase_							 =     keep_accents
         UpperCAmelCase_							 =     vocab_file

         UpperCAmelCase_							 =     spm.SentencePieceProcessor(**self.sp_model_kwargs				)
         self.sp_model.Load(__snake_case				)
     @property
     def   lowerCamelCase_   (	self   :			Dict				):
         return len(self.sp_model				)
     def   lowerCamelCase_   (	self   :			Optional[int]				):
         UpperCAmelCase_							 =     {self.convert_ids_to_tokens(__snake_case				): i for i in range(self.vocab_size				)}
         vocab.update(self.added_tokens_encoder				)
         return vocab
     def __getstate__(	self   :			Union[str, Any]				):
         UpperCAmelCase_							 =     self.__dict__.copy()
         UpperCAmelCase_							 =     None
         return state
     def __setstate__(	self   :			Optional[Any]					,    __snake_case   :			List[str]				):
         UpperCAmelCase_							 =     d

         # for backward compatibility
         if not hasattr(self					,    '''sp_model_kwargs'''				):
             UpperCAmelCase_							 =     {}

         UpperCAmelCase_							 =     spm.SentencePieceProcessor(**self.sp_model_kwargs				)
         self.sp_model.Load(self.vocab_file				)
     def   lowerCamelCase_   (	self   :			Tuple					,    __snake_case   :			List[str]				):
         if self.remove_space:
             UpperCAmelCase_							 =     ''' '''.join(inputs.strip().split()				)
         else:
             UpperCAmelCase_							 =     inputs
         UpperCAmelCase_							 =     outputs.replace('''``'''					,    '''"'''				).replace('''\'\''''					,    '''"'''				)

         if not self.keep_accents:
             UpperCAmelCase_							 =     unicodedata.normalize('''NFKD'''					,    __snake_case				)
             UpperCAmelCase_							 =     ''''''.join([c for c in outputs if not unicodedata.combining(__snake_case				)]				)
         if self.do_lower_case:
             UpperCAmelCase_							 =     outputs.lower()

         return outputs
     def   lowerCamelCase_   (	self   :			Dict					,    __snake_case   :			str				):
         UpperCAmelCase_							 =     self.preprocess_text(__snake_case				)
         UpperCAmelCase_							 =     self.sp_model.encode(__snake_case					,    out_type=__snake_case				)
         UpperCAmelCase_							 =     []
         for piece in pieces:
             if len(__snake_case				) > 1 and piece[-1] == str(''','''				) and piece[-2].isdigit():
                 UpperCAmelCase_							 =     self.sp_model.EncodeAsPieces(piece[:-1].replace(__snake_case					,    ''''''				)				)
                 if piece[0] != SPIECE_UNDERLINE and cur_pieces[0][0] == SPIECE_UNDERLINE:
                     if len(cur_pieces[0]				) == 1:
                         UpperCAmelCase_							 =     cur_pieces[1:]
                     else:
                         UpperCAmelCase_							 =     cur_pieces[0][1:]
                 cur_pieces.append(piece[-1]				)
                 new_pieces.extend(__snake_case				)
             else:
                 new_pieces.append(__snake_case				)

         return new_pieces
     def   lowerCamelCase_   (	self   :			str					,    __snake_case   :			int				):
         return self.sp_model.PieceToId(__snake_case				)
     def   lowerCamelCase_   (	self   :			Union[str, Any]					,    __snake_case   :			List[str]				):
         return self.sp_model.IdToPiece(__snake_case				)
     def   lowerCamelCase_   (	self   :			Optional[int]					,    __snake_case   :			int				):
         UpperCAmelCase_							 =     []
         UpperCAmelCase_							 =     ''''''
         UpperCAmelCase_							 =     False
         for token in tokens:
             # make sure that special tokens are not decoded using sentencepiece model
             if token in self.all_special_tokens:
                 if not prev_is_special:
                     out_string += " "
                 out_string += self.sp_model.decode(__snake_case				) + token
                 UpperCAmelCase_							 =     True
                 UpperCAmelCase_							 =     []
             else:
                 current_sub_tokens.append(__snake_case				)
                 UpperCAmelCase_							 =     False
         out_string += self.sp_model.decode(__snake_case				)
         return out_string.strip()
     def   lowerCamelCase_   (	self   :			Any					,    __snake_case   :			List[int]					,    __snake_case   :			bool = False					,    __snake_case   :			bool = None					,    __snake_case   :			bool = True					,    **__snake_case   :			Optional[Any]					,    ):
         UpperCAmelCase_							 =     kwargs.pop('''use_source_tokenizer'''					,    __snake_case				)

         UpperCAmelCase_							 =     self.convert_ids_to_tokens(__snake_case					,    skip_special_tokens=__snake_case				)

         # To avoid mixing byte-level and unicode for byte-level BPT
         # we need to build string separately for added tokens and byte-level tokens
         # cf. https://github.com/huggingface/transformers/issues/1133
         UpperCAmelCase_							 =     []
         UpperCAmelCase_							 =     []
         for token in filtered_tokens:
             if skip_special_tokens and token in self.all_special_ids:
                 continue
             if token in self.added_tokens_encoder:
                 if current_sub_text:
                     sub_texts.append(self.convert_tokens_to_string(__snake_case				)				)
                     UpperCAmelCase_							 =     []
                 sub_texts.append(__snake_case				)
             else:
                 current_sub_text.append(__snake_case				)
         if current_sub_text:
             sub_texts.append(self.convert_tokens_to_string(__snake_case				)				)

         # Mimic the behavior of the Rust tokenizer:
         # No space after <unk>
         if spaces_between_special_tokens:
             UpperCAmelCase_							 =     re.sub(R'''(<unk>) '''					,    R'''\1'''					,    ''' '''.join(__snake_case				)				)
         else:
             UpperCAmelCase_							 =     ''''''.join(__snake_case				)

         UpperCAmelCase_							 =     (
             clean_up_tokenization_spaces
             if clean_up_tokenization_spaces is not None
             else self.clean_up_tokenization_spaces
         )
         if clean_up_tokenization_spaces:
             UpperCAmelCase_							 =     self.clean_up_tokenization(__snake_case				)
             return clean_text
         else:
             return text
     def   lowerCamelCase_   (	self   :			Optional[int]					,    __snake_case   :			List[int]					,    __snake_case   :			Optional[List[int]] = None				):
         UpperCAmelCase_							 =     [self.sep_token_id]
         UpperCAmelCase_							 =     [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   lowerCamelCase_   (	self   :			str					,    __snake_case   :			List[int]					,    __snake_case   :			Optional[List[int]] = None					,    __snake_case   :			bool = False				):

         if already_has_special_tokens:
             return super().get_special_tokens_mask(
                 token_ids_a=__snake_case					,    token_ids_a=__snake_case					,    already_has_special_tokens=__snake_case				)

         if token_ids_a is not None:
             return [1] + ([0] * len(__snake_case				)) + [1] + ([0] * len(__snake_case				)) + [1]
         return [1] + ([0] * len(__snake_case				)) + [1]
     def   lowerCamelCase_   (	self   :			Dict					,    __snake_case   :			List[int]					,    __snake_case   :			Optional[List[int]] = None				):
         UpperCAmelCase_							 =     [self.sep_token_id]
         UpperCAmelCase_							 =     [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   lowerCamelCase_   (	self   :			Optional[int]					,    __snake_case   :			str					,    __snake_case   :			Optional[str] = None				):
         if not os.path.isdir(__snake_case				):
             logger.error(F'Vocabulary path ({save_directory}) should be a directory'				)
             return
         UpperCAmelCase_							 =     os.path.join(
             __snake_case					,    (filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']				)

         if os.path.abspath(self.vocab_file				) != os.path.abspath(__snake_case				) and os.path.isfile(self.vocab_file				):
             copyfile(self.vocab_file					,    __snake_case				)
         elif not os.path.isfile(self.vocab_file				):
             with open(__snake_case					,    '''wb'''				) as fi:
                 UpperCAmelCase_							 =     self.sp_model.serialized_model_proto()
                 fi.write(__snake_case				)

         return (out_vocab_file,)











import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute




def 					SCREAMING_SNAKE_CASE	(       __UpperCamelCase			:						int = 1       ,     __UpperCamelCase			:						int = 1      )  ->							qiskit.result.counts.Counts:
    if isinstance(__UpperCamelCase       ,     __UpperCamelCase      ) or isinstance(__UpperCamelCase       ,     __UpperCamelCase      ):
        raise TypeError('''inputs must be integers.'''      )
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError('''inputs must be positive.'''      )
    if (math.floor(__UpperCamelCase      ) != bit_a) or (math.floor(__UpperCamelCase      ) != bit_a):
        raise ValueError('''inputs must be exact integers.'''      )
    if (bit_a > 1) or (bit_a > 1):
        raise ValueError('''inputs must be less or equal to 1.'''      )

    # build registers
    UpperCAmelCase_							 =     QuantumRegister(2       ,     '''qr'''      )
    UpperCAmelCase_							 =     ClassicalRegister(2       ,     '''cr'''      )

    UpperCAmelCase_							 =     QuantumCircuit(__UpperCamelCase       ,     __UpperCamelCase      )

    # entanglement the qubits
    quantum_circuit.h(1      )
    quantum_circuit.cx(1       ,     0      )

    # send the information
    UpperCAmelCase_							 =     str(__UpperCamelCase      ) + str(__UpperCamelCase      )

    if c_information == "11":
        quantum_circuit.x(1      )
        quantum_circuit.z(1      )
    elif c_information == "10":
        quantum_circuit.z(1      )
    elif c_information == "01":
        quantum_circuit.x(1      )
    else:
        quantum_circuit.i(1      )

    # unentangled the circuit
    quantum_circuit.cx(1       ,     0      )
    quantum_circuit.h(1      )

    # measure the circuit
    quantum_circuit.measure(__UpperCamelCase       ,     __UpperCamelCase      )

    UpperCAmelCase_							 =     Aer.get_backend('''aer_simulator'''      )
    UpperCAmelCase_							 =     execute(__UpperCamelCase       ,     __UpperCamelCase       ,     shots=1000      )

    return job.result().get_counts(__UpperCamelCase      )


if __name__ == "__main__":
 print(F"Counts for classical state send: {superdense_coding(1,1)}")





