
    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  ej                  e      ZddiZg d	Z G d
 de
      ZdgZy)z*Tokenization class for Funnel Transformer.    )	Tokenizerdecodersnormalizerspre_tokenizers
processors)	WordPiece   )TokenizersBackend)logging
vocab_filez	vocab.txt)
smallz
small-basemediumzmedium-baseintermediatezintermediate-baselargez
large-basexlargezxlarge-basec                        e Zd ZU dZeZeZdZe	e
d<   	 	 	 	 	 	 	 	 	 	 	 	 	 dd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dz  def fdZ xZS )FunnelTokenizeraf  
    Construct a Funnel Transformer tokenizer (backed by HuggingFace's tokenizers library). Based on WordPiece.

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

    Args:
        vocab_file (`str`):
            File containing the vocabulary.
        do_lower_case (`bool`, *optional*, defaults to `True`):
            Whether or not to lowercase the input when tokenizing.
        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.
        clean_text (`bool`, *optional*, defaults to `True`):
            Whether or not to clean the text before tokenization by removing any control characters and replacing all
            whitespaces by the classic one.
        tokenize_chinese_chars (`bool`, *optional*, defaults to `True`):
            Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see [this
            issue](https://github.com/huggingface/transformers/issues/328)).
        bos_token (`str`, `optional`, defaults to `"<s>"`):
            The beginning of sentence token.
        eos_token (`str`, `optional`, defaults to `"</s>"`):
            The end of sentence token.
        strip_accents (`bool`, *optional*):
            Whether or not to strip all accents. If this option is not specified, then it will be determined by the
            value for `lowercase` (as in the original BERT).
        wordpieces_prefix (`str`, *optional*, defaults to `"##"`):
            The prefix for subwords.
        vocab (`str` or `dict[str, int]`, *optional*):
            Custom vocabulary dictionary.
       cls_token_type_idNvocabdo_lower_case	unk_token	sep_token	pad_token	cls_token
mask_token	bos_token	eos_token
clean_texttokenize_chinese_charsstrip_accentswordpieces_prefixc                 4   || _         || _        || _        |
| _        || _        ||nNt        |      dt        |      dt        |      dt        |      dt        |      dt        |      dt        |	      di| _        t        t        | j                  t        |                  | _	        t        j                  |
|||	      | j                  _        t        j                         | j                  _        t!        j                  |
      | j                  _        t%        | L  d||||||||	|
|||d| t)        j*                  | d| d| d| d| dt        |      | j,                  ft        |      | j.                  fg      | j                  _        y )Nr      r   r	            )r   )r   handle_chinese_charsr!   	lowercase)prefix)r   r   r   r   r   r   r   r   r   r    r!   r"   z:2 $A:0 z:0z:0 $B:1 z:1)singlepairspecial_tokens )r   r    r!   r   r"   str_vocabr   r   
_tokenizerr   BertNormalizer
normalizerr   BertPreTokenizerpre_tokenizerr   decodersuper__init__r   TemplateProcessingcls_token_idsep_token_idpost_processor)selfr   r   r   r   r   r   r   r   r   r   r    r!   r"   kwargs	__class__s                  `/opt/pipecat/venv/lib/python3.12/site-packages/transformers/models/funnel/tokenization_funnel.pyr8   zFunnelTokenizer.__init__[   s   " +&<#*$!2    IIIIJII 	 $IdkkS^$TU%0%?%?!!7'#	&
" )7(G(G(I%"*"4"4<M"N 	
'!!#9'/	
 	
 *4)F)F[26;hyk)BGY!2!23Y!2!23*
&    )NTz<unk>z<sep>z<pad>z<cls>z<mask>z<s>z</s>TTNz##)__name__
__module____qualname____doc__VOCAB_FILES_NAMESvocab_files_namesr   modelr   int__annotations__r/   dictboolr8   __classcell__)r?   s   @r@   r   r   )   s    +Z *Es .2"    "'+%)!%F
T#s(^#d*F
 F
 	F

 F
 F
 F
 F
 F
 F
 F
 !%F
 d{F
 F
 F
rA   r   N)rE   
tokenizersr   r   r   r   r   tokenizers.modelsr   tokenization_utils_tokenizersr
   utilsr   
get_loggerrB   loggerrF   _model_namesr   __all__r.   rA   r@   <module>rV      sY    1 S S ' >  
		H	%!;/ x
' x
v 
rA   