
    qi                         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y)z+Tokenization classes for the BARThez model.    )Regex	Tokenizerdecodersnormalizerspre_tokenizers)Unigram   )
AddedToken)TokenizersBackend)loggingzsentencepiece.bpe.modelztokenizer.json)
vocab_filetokenizer_file   ▁c                   ^     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 )BarthezTokenizera  
    Adapted from [`CamembertTokenizer`] and [`BartTokenizer`]. Construct a "fast" BARThez tokenizer. Based on
    [SentencePiece](https://github.com/google/sentencepiece).

    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.
        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.
        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.
    	input_idsattention_maskNvocabc
                    t        |t              rt        |dd      n|}|	| _        ||| _        nCt        |      dft        |      dft        |      dft        |      dft        |      dfg| _        t        t        | j                  dd            | _        t        j                  t        j                  t        d      d      t        j                         t        j                  dd	      g      | j                  _        |	rd
nd}t        j                   d|      | j                  _        t%        j                   d|      | j                  _        t)        | T  d||||||||	d|
 y )NTF)lstriprstripg        r	   )unk_idbyte_fallbackz\s{2,}|[\n\r\t] )leftrightalwaysneverr   )replacementprepend_scheme)	bos_token	eos_token	unk_token	sep_token	cls_token	pad_token
mask_tokenadd_prefix_space )
isinstancestrr
   r(   _vocabr   r   
_tokenizerr   SequenceReplacer   NFCStrip
normalizerr   	Metaspacepre_tokenizerr   decodersuper__init__)selfr   r!   r"   r$   r%   r#   r&   r'   r(   kwargsr    	__class__s               b/opt/pipecat/venv/lib/python3.12/site-packages/transformers/models/barthez/tokenization_barthez.pyr7   zBarthezTokenizer.__init__Z   sZ    KUU_adJeZ
4Fku
 0DK Y%Y%Y%Y%Z#&DK $GDKKQV$WX%0%9%9##E*<$=sC!!!uD9&
" &67(6(@(@Ucq(r%"*"4"4We"f 
	
!-
	
 
	
    )	N<s></s>r>   r=   z<unk>z<pad>z<mask>T)__name__
__module____qualname____doc__VOCAB_FILES_NAMESvocab_files_namesmodel_input_namesslow_tokenizer_classr+   dictlistr7   __classcell__)r:   s   @r;   r   r       s`    3j *$&67 +/3
TzD 4'3
 3
r<   r   N)rB   
tokenizersr   r   r   r   r   tokenizers.modelsr   tokenization_pythonr
   tokenization_utils_tokenizersr   utilsr   
get_loggerr?   loggerrC   SPIECE_UNDERLINEr   __all__r)   r<   r;   <module>rS      s^    2 N N % - >  
		H	%#<P`a   m
( m
` 
r<   