§
    ‚Štj   ã                   ó¦   — d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ  ej        e¦  «        Zdd	d
œZdZ G d„ de¦  «        ZdgZdS )z)Tokenization classes for Camembert model.é    )Ú	TokenizerÚdecodersÚnormalizersÚpre_tokenizersÚ
processors)ÚUnigramé   )Ú
AddedToken)ÚTokenizersBackend)Úloggingzsentencepiece.bpe.modelztokenizer.json)Ú
vocab_fileÚtokenizer_fileõ   â–�c                   ód   ‡ — e Zd ZdZeZddgZdZ	 	 	 	 	 	 	 	 	 	 	 	 ddee	z  e
z  dz  fˆ fd„Zˆ xZS )ÚCamembertTokenizeraŒ  
    Construct a "fast" CamemBERT tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from
    [`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on
    [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).

    This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
    refer to this superclass for more information regarding those methods.

    Args:
        bos_token (`str`, *optional*, defaults to `"<s>"`):
            The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

            <Tip>

            When building a sequence using special tokens, this is not the token that is used for the beginning of
            sequence. The token used is the `cls_token`.

            </Tip>

        eos_token (`str`, *optional*, defaults to `"</s>"`):
            The end of sequence token.

            <Tip>

            When building a sequence using special tokens, this is not the token that is used for the end of sequence.
            The token used is the `sep_token`.

            </Tip>

        sep_token (`str`, *optional*, defaults to `"</s>"`):
            The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
            sequence classification or for a text and a question for question answering. It is also used as the last
            token of a sequence built with special tokens.
        cls_token (`str`, *optional*, defaults to `"<s>"`):
            The classifier token which is used when doing sequence classification (classification of the whole sequence
            instead of per-token classification). It is the first token of the sequence when built with special tokens.
        unk_token (`str`, *optional*, defaults to `"<unk>"`):
            The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
            token instead.
        pad_token (`str`, *optional*, defaults to `"<pad>"`):
            The token used for padding, for example when batching sequences of different lengths.
        mask_token (`str`, *optional*, defaults to `"<mask>"`):
            The token used for masking values. This is the token used when training this model with masked language
            modeling. This is the token which the model will try to predict.
        additional_special_tokens (`list[str]`, *optional*, defaults to `["<s>NOTUSED", "</s>NOTUSED"]`):
            Additional special tokens used by the tokenizer.
        add_prefix_space (`bool`, *optional*, defaults to `True`):
            Whether or not to add an initial space to the input. This allows to treat the leading word just as any
            other word.
        vocab_file (`str`, *optional*):
            [SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension) that
            contains the vocabulary necessary to instantiate a tokenizer.
        vocab (`str`, `dict` or `list`, *optional*):
            Custom vocabulary dictionary. If not provided, vocabulary is loaded from vocab_file.
    Ú	input_idsÚattention_maskNú<s>ú</s>ú<unk>ú<pad>ú<mask>TÚvocabc                 óF  •‡— || _         |
| _        t          |t          ¦  «        rt	          |dd¬¦  «        n|}|	€g d¢}	|�_|| _        t          ˆfd„t          | j        ¦  «        D ¦   «         d¦  «        }t          t          | j        |d¬¦  «        ¦  «        | _
        ncdt          |¦  «        d	fd
t          ‰¦  «        d	fdt          |¦  «        d	fg| _        t          t          | j        dd¬¦  «        ¦  «        | _
        |�t          j        |¦  «        | j
        _        |
rdnd}t          j        t          j        ¦   «         t          j        t$          |d¬¦  «        g¦  «        | j
        _        t)          j        d|¬¦  «        | j
        _         t-          ¦   «         j        d||||‰|||	|
dœ	|¤Ž t1          j        | j        › d| j        › �| j        › d| j        › d| j        › d| j        › �| j        | j        f| j        | j        fg¬¦  «        | j
        _        d S )NT)ÚlstripÚspecial)ú
<s>NOTUSEDú</s>NOTUSEDú<unk>NOTUSEDc              3   óN   •K  — | ]\  }\  }}|t          ‰¦  «        k    ¯|V — Œ d S )N)Ústr)Ú.0ÚiÚtokÚ_Ú	unk_tokens       €úr/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/camembert/tokenization_camembert.pyú	<genexpr>z.CamembertTokenizer.__init__.<locals>.<genexpr>w   s?   øè è € ÐcÐc¡K A¡x¨¨QÈSÕTWÐXaÑTbÔTbÒMbÐMb˜aÐMbÐMbÐMbÐMbÐcÐcó    r   F)Úunk_idÚbyte_fallback)r   ç        r,   )r   r,   )r   iœÿÿÿr	   ÚalwaysÚnever)ÚreplacementÚprepend_schemeÚsplitr   )r/   r0   )	Ú	bos_tokenÚ	eos_tokenÚ	sep_tokenÚ	cls_tokenr&   Ú	pad_tokenÚ
mask_tokenÚadditional_special_tokensÚadd_prefix_spacez $A ú z $B )ÚsingleÚpairÚspecial_tokens© )r   r9   Ú
isinstancer!   r
   Ú_vocabÚnextÚ	enumerater   r   Ú
_tokenizerr   ÚPrecompiledÚ
normalizerr   ÚSequenceÚWhitespaceSplitÚ	MetaspaceÚSPIECE_UNDERLINEÚpre_tokenizerr   ÚdecoderÚsuperÚ__init__r   ÚTemplateProcessingr2   r3   Úbos_token_idÚeos_token_idÚpost_processor)Úselfr2   r3   r4   r5   r&   r6   Ú_spm_precompiled_charsmapr7   r8   r9   r   r   ÚkwargsÚ	unk_indexr0   Ú	__class__s        `          €r'   rM   zCamembertTokenizer.__init__]   sd  øø€ ð  %ˆŒØ 0ˆÔåJTÐU_ÕadÑJeÔJeÐu•Z 
°4ÀÐFÑFÔFÐFÐkuˆ
à$Ð,Ø(UÐ(UÐ(UÐ%àÐØˆDŒKÝÐcÐcÐcÐcµ9¸T¼[Ñ3IÔ3IÐcÑcÔcÐefÑgÔgˆIÝ'­°´ÀIÐ]bÐ(cÑ(cÔ(cÑdÔdˆDŒOˆOð $Ý�Y‘” Ð%Ø$Ý�Y‘” Ð%Ø&Ý�Z‘” #Ð&ðˆDŒKõ (­°´ÀAÐUZÐ([Ñ([Ô([Ñ\Ô\ˆDŒOà$Ð0Ý)4Ô)@ÐAZÑ)[Ô)[ˆDŒOÔ&à%5ÐB˜˜¸7ˆÝ(6Ô(?åÔ.Ñ0Ô0ÝÔ(Õ5EÐVdÐlpÐqÑqÔqðñ)
ô )
ˆŒÔ%õ #+Ô"4ÀÐWeÐ"fÑ"fÔ"fˆŒÔà�‰ŒÔð 	
ØØØØØØØ!Ø&?Ø-ð	
ð 	
ð ð	
ð 	
ð 	
õ *4Ô)FØ”nÐ:Ð:¨$¬.Ð:Ð:Ø”NÐ]Ð]¨¬Ð]Ð]¸¼Ð]Ð]ÈTÌ^Ð]Ð]à” Ô!2Ð3Ø” Ô!2Ð3ðð*
ñ *
ô *
ˆŒÔ&Ð&Ð&r)   )r   r   r   r   r   r   Nr   NTNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚVOCAB_FILES_NAMESÚvocab_files_namesÚmodel_input_namesÚslow_tokenizer_classr!   ÚdictÚlistrM   Ú__classcell__)rV   s   @r'   r   r       s±   ø€ € € € € ð6ð 6ðp *ÐØ$Ð&6Ð7ÐØÐð ØØØØØØ"&ØØ"&ØØØ*.ðH
ð H
ð �T‰z˜DÑ  4Ñ'ðH
ð H
ð H
ð H
ð H
ð H
ð H
ð H
ð H
ð H
r)   r   N)rZ   Ú
tokenizersr   r   r   r   r   Útokenizers.modelsr   Útokenization_pythonr
   Útokenization_utils_tokenizersr   Úutilsr   Ú
get_loggerrW   Úloggerr[   rI   r   Ú__all__r>   r)   r'   ú<module>rj      sì   ðð 0Ð /à SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SÐ SØ %Ð %Ð %Ð %Ð %Ð %à -Ð -Ð -Ð -Ð -Ð -Ø >Ð >Ð >Ð >Ð >Ð >Ø Ð Ð Ð Ð Ð ð 
ˆÔ	˜HÑ	%Ô	%€à#<ÐP`ÐaÐaÐ ð Ð ðE
ð E
ð E
ð E
ð E
Ð*ñ E
ô E
ð E
ðP  Ð
 €€€r)   