Ë
    S^(hK  ã                   óˆ   — d dl 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	d
œZ G d„ de«      ZdgZy)é    )ÚListÚOptionalÚTupleé   )ÚPreTrainedTokenizerFast)Úloggingé   )ÚHerbertTokenizerz
vocab.jsonz
merges.txtztokenizer.json)Ú
vocab_fileÚmerges_fileÚtokenizer_filec            
       óö   ‡ — e Zd ZdZeZeZ	 	 	 	 	 	 	 	 dˆ fd„	Z	 dde	e
   dee	e
      de	e
   fd„Z	 dde	e
   dee	e
      dede	e
   fˆ fd„Z	 dde	e
   dee	e
      de	e
   fd	„Zdd
edee   dee   fd„Zˆ xZS )ÚHerbertTokenizerFastam  
    Construct a "Fast" BPE tokenizer for HerBERT (backed by HuggingFace's *tokenizers* library).

    Peculiarities:

    - uses BERT's pre-tokenizer: BertPreTokenizer splits tokens on spaces, and also on punctuation. Each occurrence of
      a punctuation character will be treated separately.

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

    Args:
        vocab_file (`str`):
            Path to the vocabulary file.
        merges_file (`str`):
            Path to the merges file.
    c	           
      ó6   •— t        ‰
| �  ||f||||||dœ|	¤Ž y )N)r   Ú	cls_tokenÚ	unk_tokenÚ	pad_tokenÚ
mask_tokenÚ	sep_token)ÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r   ÚkwargsÚ	__class__s             €ús/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/herbert/tokenization_herbert_fast.pyr   zHerbertTokenizerFast.__init__2   s;   ø€ ô 	‰ÑØØð
	
ð *ØØØØ!Øñ
	
ð ó
	
ó    Útoken_ids_0Útoken_ids_1Úreturnc                 óf   — | j                   g}| j                  g}|€||z   |z   S ||z   |z   |z   |z   S )až  
        Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
        adding special tokens. An HerBERT, like BERT sequence has the following format:

        - single sequence: `<s> X </s>`
        - pair of sequences: `<s> A </s> B </s>`

        Args:
            token_ids_0 (`List[int]`):
                List of IDs to which the special tokens will be added.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.

        Returns:
            `List[int]`: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.
        )Úcls_token_idÚsep_token_id)r   r   r   ÚclsÚseps        r   Ú build_inputs_with_special_tokensz5HerbertTokenizerFast.build_inputs_with_special_tokensJ   sP   € ð( × Ñ Ð!ˆØ× Ñ Ð!ˆØÐØ˜Ñ$ sÑ*Ð*à�[Ñ  3Ñ&¨Ñ4°sÑ:Ð:r   Úalready_has_special_tokensc                 ó´   •— |rt         ‰| �  ||d¬«      S |€dgdgt        |«      z  z   dgz   S dgdgt        |«      z  z   dgz   dgt        |«      z  z   dgz   S )aÄ  
        Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
        special tokens using the tokenizer `prepare_for_model` method.

        Args:
            token_ids_0 (`List[int]`):
                List of IDs.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.
            already_has_special_tokens (`bool`, *optional*, defaults to `False`):
                Whether or not the token list is already formatted with special tokens for the model.

        Returns:
            `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
        T)r   r   r&   r	   r   )r   Úget_special_tokens_maskÚlen)r   r   r   r&   r   s       €r   r(   z,HerbertTokenizerFast.get_special_tokens_maske   s‰   ø€ ñ$ &Ü‘7Ñ2Ø'°[Ð]að 3ó ð ð ÐØ�3˜1˜#¤ KÓ 0Ñ0Ñ1°Q°CÑ7Ð7Øˆs�q�cœC Ó,Ñ,Ñ-°°Ñ3¸°s¼SÀÓ=MÑ7MÑNÐRSÐQTÑTÐTr   c                 ó´   — | j                   g}| j                  g}|€t        ||z   |z   «      dgz  S t        ||z   |z   «      dgz  t        ||z   «      dgz  z   S )a{  
        Create a mask from the two sequences passed to be used in a sequence-pair classification task. HerBERT, like
        BERT sequence pair mask has the following format:

        ```
        0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
        | first sequence    | second sequence |
        ```

        Args:
            token_ids_0 (`List[int]`):
                List of IDs.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.

        Returns:
            `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
        r   r	   )r"   r!   r)   )r   r   r   r$   r#   s        r   Ú$create_token_type_ids_from_sequencesz9HerbertTokenizerFast.create_token_type_ids_from_sequences€   st   € ð* × Ñ Ð!ˆØ× Ñ Ð!ˆàÐÜ�s˜[Ñ(¨3Ñ.Ó/°1°#Ñ5Ð5Ü�3˜Ñ$ sÑ*Ó+¨q¨cÑ1´C¸ÀcÑ8IÓ4JÈaÈSÑ4PÑPÐPr   Úsave_directoryÚfilename_prefixc                 óf   — | j                   j                  j                  ||¬«      }t        |«      S )N)Úname)Ú
_tokenizerÚmodelÚsaveÚtuple)r   r,   r-   Úfiless       r   Úsave_vocabularyz$HerbertTokenizerFast.save_vocabularyœ   s+   € Ø—‘×%Ñ%×*Ñ*¨>ÀÐ*ÓPˆÜ�U‹|Ðr   )NNNz<s>z<unk>z<pad>z<mask>z</s>)N)NF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚVOCAB_FILES_NAMESÚvocab_files_namesr
   Úslow_tokenizer_classr   r   Úintr   r%   Úboolr(   r+   Ústrr   r5   Ú__classcell__)r   s   @r   r   r      s
  ø„ ñð$ *ÐØ+Ðð ØØØØØØØõ
ð2 JNñ;Ø ™9ð;Ø3;¸DÀ¹IÑ3Fð;à	ˆc‰ó;ð8 sxñUØ ™9ðUØ3;¸DÀ¹IÑ3FðUØkoðUà	ˆc‰õUð8 JNñQØ ™9ðQØ3;¸DÀ¹IÑ3FðQà	ˆc‰óQñ8¨cð ÀHÈSÁMð Ð]bÐcfÑ]g÷ r   r   N)Útypingr   r   r   Útokenization_utils_fastr   Úutilsr   Útokenization_herbertr
   Ú
get_loggerr6   Úloggerr:   r   Ú__all__© r   r   ú<module>rI      sR   ð÷  )Ñ (å >Ý Ý 2ð 
ˆ×	Ñ	˜HÓ	%€à#/ÀÐ`pÑqÐ ôBÐ2ô BðJ "Ð
"�r   