
    qi                         d Z ddlmZ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  ej                  e      Zddd	Z G d
 de      ZdgZy)z'Tokenization classes for RemBert model.    )Regex	Tokenizerdecodersnormalizerspre_tokenizers
processors)Unigram   )TokenizersBackend)loggingzsentencepiece.modelztokenizer.json)
vocab_filetokenizer_filec                        e Zd ZdZeZddgZeZ	 	 	 	 	 	 	 	 	 	 	 	 dde	e
ee	ef      z  dz  dedede	d	e	d
e	de	de	de	de	dedef fdZ xZS )RemBertTokenizera
  
    Construct a "fast" RemBert tokenizer (backed by HuggingFace's *tokenizers* library). Based on
    [Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This
    tokenizer inherits from [`AlbertTokenizer`] which contains most of the main methods. Users should refer to
    this superclass for more information regarding those methods

    Args:
        do_lower_case (`bool`, *optional*, defaults to `True`):
            Whether or not to lowercase the input when tokenizing.
        remove_space (`bool`, *optional*, defaults to `True`):
            Whether or not to strip the text when tokenizing (removing excess spaces before and after the string).
        keep_accents (`bool`, *optional*, defaults to `False`):
            Whether or not to keep accents when tokenizing.
        bos_token (`str`, *optional*, defaults to `"[CLS]"`):
            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 `"[SEP]"`):
            The end of sequence token. .. note:: 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`.
        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.
        sep_token (`str`, *optional*, defaults to `"[SEP]"`):
            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.
        pad_token (`str`, *optional*, defaults to `"<pad>"`):
            The token used for padding, for example when batching sequences of different lengths.
        cls_token (`str`, *optional*, defaults to `"[CLS]"`):
            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.
        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.
    	input_idsattention_maskNvocabdo_lower_casekeep_accents	bos_token	eos_token	unk_token	sep_token	pad_token	cls_token
mask_tokenadd_prefix_spaceremove_spacec                 V   || _         || _        || _        ||| _        nCt	        |      dft	        |      dft	        |	      dft	        |      dft	        |
      dfg| _        t        t        | j                  dd            | _        t        j                  dd      t        j                  dd      t        j                  t        d      d	      g}| j                  sF|j                  t        j                                |j                  t        j                                | j                  r#|j                  t        j                                |j                  t        j                  t        d
      d	      t        j                          g       t        j"                  |      | j                  _        |rdnd}t'        j(                  d|      | j                  _        t-        j(                  d|      | j                  _        t1        | d  d|||||||	|||
|d| t	        |	      }t	        |      }| j5                  |      }| j5                  |      }t7        j8                  | d| d| d| d| d||f||fg      | j                  _        t0        | y          y )Ng           F)unk_idbyte_fallbackz``"z''z {2,} z[\n\r\t]alwaysneveru   ▁)replacementprepend_scheme)r   r   r   r   r   r   r   r   r   r   r   z:0 $A:0 z:0z:0 $B:1 z:1)singlepairspecial_tokens )r   r   r   _vocab_scoresstrr   r	   
_tokenizerr   Replacer   appendNFKDStripAccents	LowercaseextendNFKCSequence
normalizerr   	Metaspacepre_tokenizerr   decodersuper__init__convert_tokens_to_idsr   TemplateProcessingpost_processor
_post_init)selfr   r   r   r   r   r   r   r   r   r   r   r   kwargslist_normalizersr(   cls_token_strsep_token_strcls_token_idsep_token_id	__class__s                       b/opt/pipecat/venv/lib/python3.12/site-packages/transformers/models/rembert/tokenization_rembert.pyr=   zRemBertTokenizer.__init__L   s     )*(!&D Y%Y%Y%Y%Z#&"D $""#
 c*c*g4

   ##K$4$4$67##K$<$<$>?##K$9$9$;< 	##E+$6<  "	
 &1%9%9:J%K"%57(6(@(@Ucq(r%"*"4"4We"f 	
-'%!%	
 	
" II11-@11-@)3)F)F#_H]O2>!?(=/-PRS--*
& 	    )NFF[CLS][SEP]z<unk>rM   z<pad>rL   z[MASK]TT)__name__
__module____qualname____doc__VOCAB_FILES_NAMESvocab_files_namesmodel_input_namesr	   modelr.   listtuplefloatboolr=   __classcell__)rI   s   @rJ   r   r      s    )V *$&67E 7;#"      "!%!cT%U
+,,t3c c 	c
 c c c c c c c c c crK   r   N)rQ   
tokenizersr   r   r   r   r   r   tokenizers.modelsr	   tokenization_utils_tokenizersr   utilsr   
get_loggerrN   loggerrR   r   __all__r,   rK   rJ   <module>rb      sS    . Z Z % >  
		H	%#8L\] S( Sl 
rK   