+
    œ°³j3  ã                   ó�   € R t ^ RIt^ RIt^ RIHt ^RIHt ^RIHt ]P                  ! ]
4      tRRRR/tR	 t ! R
 R]4      tR.tR# )z Tokenization classes for PhoBERTN)Úcopyfile)ÚPreTrainedTokenizer)ÚloggingÚ
vocab_filez	vocab.txtÚmerges_filez	bpe.codesc                óŠ   € \        4       pV ^ ,          pV R,           F  pVP                  W#34       TpK  	  \        V4      pV# )zy
Return set of symbol pairs in a word.

Word is represented as tuple of symbols (symbols being variable-length strings).
:é   NN)ÚsetÚadd)ÚwordÚpairsÚ	prev_charÚchars   &   Úq/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/phobert/tokenization_phobert.pyÚ	get_pairsr   !   sH   € ô ‹E€EØ�Q•€IØ�R—�ˆØ�	‰	�9Ð#Ô$ØŠ	ñ ô �‹J€EØ€Ló    c                   óÖ   a a€ ] tR t^1t oRt]tRV 3R lltRV3R lR lltRV3R lV 3R lllt	RV3R lR llt
]R	 4       tR
 tR tR tR tR tR tRV3R lR lltR tRtVtV ;t# )ÚPhobertTokenizeraÀ  
Construct a PhoBERT tokenizer. Based on Byte-Pair-Encoding.

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

Args:
    vocab_file (`str`):
        Path to the vocabulary file.
    merges_file (`str`):
        Path to the merges file.
    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.
c
                ó*  <€ Wn         W n        / V n        ^ V P                  \        V4      &   ^V P                  \        V4      &   ^V P                  \        V4      &   ^V P                  \        V4      &   V P	                  V4       V P                  P                  4        UUu/ uF  w  r¼WËbK	  	  uppV n        \        VRR7      ;_uu_ 4       pVP                  4       P                  R4      RR pRRR4       X Uu. uF  p\        VP                  4       RR 4      NK!  	  pp\        \        V\        \        V4      4      4      4      V n        / V n        \"        SV `H  ! RRVRVRVRVR	VR
VRV	/V
B  R# u uppi   + '       g   i     L”; iu upi )é    úutf-8©ÚencodingÚ
NÚ	bos_tokenÚ	eos_tokenÚ	unk_tokenÚ	sep_tokenÚ	cls_tokenÚ	pad_tokenÚ
mask_tokenéÿÿÿÿ© )r   r   ÚencoderÚstrÚadd_from_fileÚitemsÚdecoderÚopenÚreadÚsplitÚtupleÚdictÚzipÚrangeÚlenÚ	bpe_ranksÚcacheÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r   r    ÚkwargsÚkÚvÚmerges_handleÚmergesÚmergeÚ	__class__s   &&&&&&&&&&,     €r   r3   ÚPhobertTokenizer.__init__d   sz  ø€ ð %ŒØ&ÔàˆŒØ'(ˆ�‰”S˜“^Ñ$Ø'(ˆ�‰”S˜“^Ñ$Ø'(ˆ�‰”S˜“^Ñ$Ø'(ˆ�‰”S˜“^Ñ$à×Ñ˜:Ô&à)-¯©×);Ñ);Ô)=Ô>Ñ)=¡ ˜šÑ)=Ò>ˆŒä�+¨×0Õ0°MØ"×'Ñ'Ó)×/Ñ/°Ó5°c°rÐ:ˆF÷ 1á9?Ó@¹°”%˜Ÿ™› c rÐ*Ö+¹ˆÐ@äœc &¬%´°F³Ó*<Ó=Ó>ˆŒØˆŒ
ä‰Òñ 		
Øð		
àð		
ð  ð		
ð  ð			
ð
  ð		
ð  ð		
ð "ð		
ð ô		
ùó ?ç0×0üâ@s   Â#E7Ã#E=Ã=%FÅ=F	c                ój   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[ S[,          /# ©é   Útoken_ids_0Útoken_ids_1NÚreturn©ÚlistÚint)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚPhobertTokenizer.__annotate__�   s;   ø€ ÷ Añ AÙ¡�9ðAÙ37¹µ9¸tÕ3CðAá	‰c�ñAr   c                óÒ   € Vf'   V P                   .V,           V P                  .,           # V P                   .pV P                  .pW1,           V,           V,           V,           V,           # )a6  
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A PhoBERT sequence has the following format:

- single sequence: `<s> X </s>`
- pair of sequences: `<s> A </s></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)r4   r@   rA   ÚclsÚseps   &&&  r   Ú build_inputs_with_special_tokensÚ1PhobertTokenizer.build_inputs_with_special_tokens�   se   € ð( ÒØ×%Ñ%Ð&¨Õ4¸×8IÑ8IÐ7JÕJÐJØ× Ñ Ð!ˆØ× Ñ Ð!ˆØÕ  3Õ&¨Õ,¨{Õ:¸SÕ@Ð@r   c          	      óp   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[RS[ S[,          /# )r?   r@   rA   NÚalready_has_special_tokensrB   )rD   rE   Úbool)rF   rG   s   "€r   rH   rI   ª   sD   ø€ ÷ Xñ XÙ¡�9ðXÙ37¹µ9¸tÕ3CðXÙhlðXá	‰c�ñXr   c                ó  <€ V'       d   \         SV `  WRR7      # Vf$   ^.^ .\        V4      ,          ,           ^.,           # ^.^ .\        V4      ,          ,           ^^.,           ^ .\        V4      ,          ,           ^.,           # )ad  
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@   rA   rR   )r2   Úget_special_tokens_maskr/   )r4   r@   rA   rR   r;   s   &&&&€r   rU   Ú(PhobertTokenizer.get_special_tokens_maskª   s‰   ø€ ÷& &Ü‘7Ñ2Ø'Ð]að 3ó ð ð ÒØ�3˜1˜#¤ KÓ 0Õ0Õ1°Q°CÕ7Ð7Øˆs�q�cœC Ó,Õ,Õ-°°A°Õ6¸1¸#ÄÀKÓ@PÕ:PÕQÐUVÐTWÕWÐWr   c                ój   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[ S[,          /# r>   rC   )rF   rG   s   "€r   rH   rI   Æ   s;   ø€ ÷ Lñ LÙ¡�9ðLÙ37¹µ9¸tÕ3CðLá	‰c�ñLr   c                óè   € V P                   .pV P                  .pVf!   \        WA,           V,           4      ^ .,          # \        WA,           V,           V,           V,           V,           4      ^ .,          # )a|  
Create a mask from the two sequences passed to be used in a sequence-pair classification task. PhoBERT does not
make use of token type ids, therefore a list of zeros is returned.

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 zeros.
)rL   rK   r/   )r4   r@   rA   rN   rM   s   &&&  r   Ú$create_token_type_ids_from_sequencesÚ5PhobertTokenizer.create_token_type_ids_from_sequencesÆ   si   € ð" × Ñ Ð!ˆØ× Ñ Ð!ˆàÒÜ�sÕ(¨3Õ.Ó/°1°#Õ5Ð5Ü�3Õ$ sÕ*¨SÕ0°;Õ>ÀÕDÓEÈÈÕKÐKr   c                ó,   € \        V P                  4      # ©N)r/   r#   ©r4   s   &r   Ú
vocab_sizeÚPhobertTokenizer.vocab_sizeÞ   s   € ä�4—<‘<Ó Ð r   c                óB   € \        V P                  3/ V P                  B # r\   )r,   r#   Úadded_tokens_encoderr]   s   &r   Ú	get_vocabÚPhobertTokenizer.get_vocabâ   s   € Ü�D—L‘LÑ> D×$=Ñ$=Ñ>Ð>r   c                ó”  a € VS P                   9   d   S P                   V,          # \        V4      p\        \        VR R 4      VR,          R,           .,           4      p\        V4      pV'       g   V#  \	        VV 3R lR7      pVS P
                  9  d   MçVw  rV. p^ pV\        V4      8  d¤    VP                  WX4      p	VP                  W(V	 4       T	pY(,          T8X  dN   T\        T4      ^,
          8  d7   Y(^,           ,          T8X  d#   TP                  YV,           4       T^,          pK‘  TP                  Y(,          4       T^,          pK³  \        V4      pTp\        V4      ^8X  d   M\        V4      pEK  RP                  V4      pVR R pVS P                   V&   V#   \         d    TP                  Y(R  4        Kt  i ; i)Nz</w>c                 óN   <€ SP                   P                  V \        R 4      4      # )Úinf)r0   ÚgetÚfloat)Úpairr4   s   &€r   Ú<lambda>Ú&PhobertTokenizer.bpe.<locals>.<lambda>ð   s   ø€ °·±×1CÑ1CÀDÌ%ÐPUË,Ô1Wr   )Úkeyú@@ r!   éüÿÿÿ)r1   r+   rD   r   Úminr0   r/   ÚindexÚextendÚ
ValueErrorÚappendÚjoin)
r4   Útokenr   r   ÚbigramÚfirstÚsecondÚnew_wordÚiÚjs
   f&        r   ÚbpeÚPhobertTokenizer.bpeå   s‹  ø€ Ø�D—J‘JÔØ—:‘:˜eÕ$Ð$Ü�U‹|ˆÜ”T˜$˜s ˜)“_¨¨R­°6Õ(9Ð':Õ:Ó;ˆÜ˜$“ˆçØˆLàÜ˜Ô$WÔXˆFØ˜TŸ^™^Ô+ØØ"‰MˆEØˆHØˆAØ”c˜$“i”-ðØŸ
™
 5Ó,�Að
 —O‘O D¨1 IÔ.Ø�Aà•7˜eÔ#¨¬C°«I¸­MÔ(9¸dÀqÅ5½kÈVÔ>SØ—O‘O E¥NÔ3Ø˜•F’Aà—O‘O D¥GÔ,Ø˜•F’AÜ˜X“ˆHØˆDÜ�4‹y˜AŒ~Øä! $›“Ø�z‰z˜$ÓˆØ�C�RˆyˆØ ˆ�
‰
�5ÑØˆøô- "ô Ø—O‘O D¨ HÔ-Úðús   Â0F% Æ%GÇGc                óº   € . p\         P                  ! RV4      pV F;  pVP                  \        V P	                  V4      P                  R4      4      4       K=  	  V# )zTokenize a string.z\S+\n?Ú )ÚreÚfindallrq   rD   r|   r*   )r4   ÚtextÚsplit_tokensÚwordsru   s   &&   r   Ú	_tokenizeÚPhobertTokenizer._tokenize  sM   € àˆä—
’
˜9 dÓ+ˆãˆEØ×Ñ¤ T§X¡X¨e£_×%:Ñ%:¸3Ó%?Ó @ÖAñ àÐr   c                ó~   € V P                   P                  WP                   P                  V P                  4      4      # )z0Converts a token (str) in an id using the vocab.)r#   rg   r   )r4   ru   s   &&r   Ú_convert_token_to_idÚ%PhobertTokenizer._convert_token_to_id  s*   € à�|‰|×Ñ §|¡|×'7Ñ'7¸¿¹Ó'GÓHÐHr   c                óL   € V P                   P                  WP                  4      # )z=Converts an index (integer) in a token (str) using the vocab.)r'   rg   r   )r4   rp   s   &&r   Ú_convert_id_to_tokenÚ%PhobertTokenizer._convert_id_to_token  s   € à�|‰|×Ñ §~¡~Ó6Ð6r   c                ód   € RP                  V4      P                  RR4      P                  4       pV# )z:Converts a sequence of tokens (string) in a single string.r   rm   Ú )rt   ÚreplaceÚstrip)r4   ÚtokensÚ
out_strings   && r   Úconvert_tokens_to_stringÚ)PhobertTokenizer.convert_tokens_to_string#  s,   € à—X‘X˜fÓ%×-Ñ-¨e°RÓ8×>Ñ>Ó@ˆ
ØÐr   c                óJ   <€ V ^8„  d   QhRS[ RS[ R,          RS[S[ ,          /# )r?   Úsave_directoryÚfilename_prefixNrB   )r$   r+   )rF   rG   s   "€r   rH   rI   (  s-   ø€ ÷ .ñ .©cð .ÁCÈ$ÅJð .ÑZ_Ñ`cÕZdñ .r   c                óˆ  € \         P                  P                  V4      '       g   \        P	                  R V R24       R# \         P                  P                  Y'       d
   VR,           MR\        R,          ,           4      p\         P                  P                  Y'       d
   VR,           MR\        R,          ,           4      p\         P                  P                  V P                  4      \         P                  P                  V4      8w  dG   \         P                  P                  V P                  4      '       d   \        V P                  V4       Mw\         P                  P                  V P                  4      '       gI   \        VR4      ;_uu_ 4       pV P                  P                  4       pVP                  V4       RRR4       \         P                  P                  V P                  4      \         P                  P                  V4      8w  d   \        V P                  V4       W43#   + '       g   i     Lt; i)zVocabulary path (z) should be a directoryNÚ-rŽ   r   r   Úwb)ÚosÚpathÚisdirÚloggerÚerrorrt   ÚVOCAB_FILES_NAMESÚabspathr   Úisfiler   r(   Úsp_modelÚserialized_model_protoÚwriter   )r4   r–   r—   Úout_vocab_fileÚout_merge_fileÚfiÚcontent_spiece_models   &&&    r   Úsave_vocabularyÚ PhobertTokenizer.save_vocabulary(  su  € Ü�w‰w�}‰}˜^×,Ò,Ü�L‰LÐ,¨^Ð,<Ð<SÐTÔUÙÜŸ™Ÿ™Ø¶o˜_¨sÖ2È2ÔQbÐcoÕQpÕpó
ˆô Ÿ™Ÿ™Ø¶o˜_¨sÖ2È2ÔQbÐcpÕQqÕqó
ˆô �7‰7�?‰?˜4Ÿ?™?Ó+¬r¯w©w¯©¸~Ó/NÔNÔSU×SZÑSZ×SaÑSaÐbf×bqÑbq×SrÒSrÜ�T—_‘_ nÕ5Ü—‘—‘ §¡×0Ò0Ü�n d×+Ô+¨rØ'+§}¡}×'KÑ'KÓ'MÐ$Ø—‘Ð-Ô.÷ ,ô �7‰7�?‰?˜4×+Ñ+Ó,´·±·±ÀÓ0OÔOÜ�T×%Ñ% ~Ô6àÐ-Ð-÷ ,×+ús   Æ,H1È1I	c                ó  € \        V\        4      '       d4    \        VRRR7      ;_uu_ 4       pV P                  V4       RRR4       R# VP                  4       pV F]  pVP                  4       pVP                  R4      pVR	8X  d   \        R4      hVRV p\        V P                  4      V P                  V&   K_  	  R#   + '       g   i     R# ; i  \         d   pThRp?i\
         d    \        RT R24      hi ; i)
zY
Loads a pre-existing dictionary from a text file and adds its symbols to this instance.
Úrr   r   NzIncorrect encoding detected in z, please rebuild the datasetr   z5Incorrect dictionary format, expected '<token> <cnt>'r!   )Ú
isinstancer$   r(   r%   ÚFileNotFoundErrorÚUnicodeErrorÚ	ExceptionÚ	readlinesr�   Úrfindrr   r/   r#   )	r4   ÚfÚfdÚfnfeÚlinesÚlineTmpÚlineÚidxr   s	   &&       r   r%   ÚPhobertTokenizer.add_from_fileE  sæ   € ô �aœ×ÒðcÜ˜!˜S¨7×3Õ3°rØ×&Ñ& rÔ*÷ 4ñ à—‘“ˆÛˆGØ—=‘=“?ˆDØ—*‘*˜S“/ˆCØ�bŒyÜ Ð!XÓYÐYØ˜˜�:ˆDÜ!$ T§\¡\Ó!2ˆD�L‰L˜Óó ÷ 4Ö3ñ ûô	 %ô Ø�
ûÜô cÜÐ"AÀ!ÀÐD`Ð aÓbÐbðcús:   ˜C ®B?Á C Â?C	Ã
C ÃC ÃC>ÃC Ã C>Ã-C>)r0   r1   r'   r#   r   r   )ú<s>ú</s>r½   r¼   z<unk>z<pad>z<mask>r\   )NF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r    Úvocab_files_namesr3   rO   rU   rY   Úpropertyr^   rb   r|   r…   rˆ   r‹   r“   rª   r%   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r;   rG   s   @@r   r   r   1   s…   ù‡ € ñ.ð` *Ð÷*
÷XAò A÷4Xõ X÷8Lò Lð0 ñ!ó ð!ò?ò*òXòIò7ò÷
.ò .÷:3ò 3r   r   )rÂ   r›   r€   Úshutilr   Útokenization_pythonr   Úutilsr   Ú
get_loggerr¾   rž   r    r   r   Ú__all__r"   r   r   Ú<module>rÍ      s^   ðñ 'ã 	Û 	Ý å 6Ý ð 
×	Ò	˜HÓ	%€ð �+Ø�;ðÐ òô i3Ð*ô i3ðX	 Ð
‚r   