
    qi@                       d Z ddlZddlZddlmZ ddlZddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd	lmZ dd
lmZmZmZ  ej@                  e!      Z"e#e$e$f   Z%e&e%   Z'e(Z)e&e)   Z*ddddZ+dZ, G d de      Z-dgZ.y)zTokenization classes for LUKE.    N)Mapping)	Tokenizerdecoderspre_tokenizers)BPE   )PreTrainedTokenizer)
ENCODE_KWARGS_DOCSTRING
AddedTokenBatchEncodingEncodedInputPaddingStrategy
TensorType	TextInputTextInputPairTruncationStrategy	to_py_obj)TokenizersBackend)add_end_docstringsis_torch_tensorloggingz
vocab.jsonz
merges.txtzentity_vocab.json)
vocab_filemerges_fileentity_vocab_fileav  
            return_token_type_ids (`bool`, *optional*):
                Whether to return token type IDs. If left to the default, will return the token type IDs according to
                the specific tokenizer's default, defined by the `return_outputs` attribute.

                [What are token type IDs?](../glossary#token-type-ids)
            return_attention_mask (`bool`, *optional*):
                Whether to return the attention mask. If left to the default, will return the attention mask according
                to the specific tokenizer's default, defined by the `return_outputs` attribute.

                [What are attention masks?](../glossary#attention-mask)
            return_overflowing_tokens (`bool`, *optional*, defaults to `False`):
                Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch
                of pairs) is provided with `truncation_strategy = longest_first` or `True`, an error is raised instead
                of returning overflowing tokens.
            return_special_tokens_mask (`bool`, *optional*, defaults to `False`):
                Whether or not to return special tokens mask information.
            return_offsets_mapping (`bool`, *optional*, defaults to `False`):
                Whether or not to return `(char_start, char_end)` for each token.

                This is only available on fast tokenizers inheriting from [`PreTrainedTokenizerFast`], if using
                Python's tokenizer, this method will raise `NotImplementedError`.
            return_length  (`bool`, *optional*, defaults to `False`):
                Whether or not to return the lengths of the encoded inputs.
            verbose (`bool`, *optional*, defaults to `True`):
                Whether or not to print more information and warnings.
            **kwargs: passed to the `self.tokenize()` method

        Return:
            [`BatchEncoding`]: A [`BatchEncoding`] with the following fields:

            - **input_ids** -- List of token ids to be fed to a model.

              [What are input IDs?](../glossary#input-ids)

            - **token_type_ids** -- List of token type ids to be fed to a model (when `return_token_type_ids=True` or
              if *"token_type_ids"* is in `self.model_input_names`).

              [What are token type IDs?](../glossary#token-type-ids)

            - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
              `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names`).

              [What are attention masks?](../glossary#attention-mask)

            - **entity_ids** -- List of entity ids to be fed to a model.

              [What are input IDs?](../glossary#input-ids)

            - **entity_position_ids** -- List of entity positions in the input sequence to be fed to a model.

            - **entity_token_type_ids** -- List of entity token type ids to be fed to a model (when
              `return_token_type_ids=True` or if *"entity_token_type_ids"* is in `self.model_input_names`).

              [What are token type IDs?](../glossary#token-type-ids)

            - **entity_attention_mask** -- List of indices specifying which entities should be attended to by the model
              (when `return_attention_mask=True` or if *"entity_attention_mask"* is in `self.model_input_names`).

              [What are attention masks?](../glossary#attention-mask)

            - **entity_start_positions** -- List of the start positions of entities in the word token sequence (when
              `task="entity_span_classification"`).
            - **entity_end_positions** -- List of the end positions of entities in the word token sequence (when
              `task="entity_span_classification"`).
            - **overflowing_tokens** -- List of overflowing tokens sequences (when a `max_length` is specified and
              `return_overflowing_tokens=True`).
            - **num_truncated_tokens** -- Number of tokens truncated (when a `max_length` is specified and
              `return_overflowing_tokens=True`).
            - **special_tokens_mask** -- List of 0s and 1s, with 1 specifying added special tokens and 0 specifying
              regular sequence tokens (when `add_special_tokens=True` and `return_special_tokens_mask=True`).
            - **length** -- The length of the inputs (when `return_length=True`)

c            2       ~	    e Zd ZdZeZddgZeZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dGde	e
e	ef   z  dz  de	ee	   z  dz  de	e
z  ez  dz  f fd	Z	 dHd
ee   dee   dz  dee   fdZ	 dId
ee   dee   dz  dedee   fdZ	 dHd
ee   dee   dz  dee   fdZ	 	 dJdeee   z  dededz  de	f fdZ eee      	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dKdeee   z  deee   z  dz  deee   z  dz  deee   z  dz  deee   z  dz  deee   z  dz  dedee	z  ez  dee	z  ez  d edz  d!edz  d"ed#edz  d$edz  d%e	dz  d&e	ez  dz  d'edz  d(edz  d)ed*ed+ed,ed-edef0 fd.       Zddddddej<                  ej>                  ddddddddddddddfdededz  dedz  dedz  dedz  dedz  ded/ed0ed edz  d!edz  d"ed#edz  d$edz  d%e	dz  d&e	ez  dz  d'edz  d(edz  d)ed*ed+ed,ed-edef0 fd1Z dddej<                  ej>                  ddddddddddddddfd2ee   ee!   z  d3ee   ee"eef      z  dz  d4ee   ee"eef      z  dz  ded/ed0ed edz  d!edz  d"ed#edz  d$edz  d%e	dz  d&e	ez  dz  d'edz  d(edz  d)ed*ed+ed,ed-edef* fd5Z#dedz  dedz  fd6Z$	 	 	 	 	 dLdededz  dedz  dedz  dedz  dedz  de"eeeeeef   fd7Z% eee      dej<                  ej>                  ddddddddddddfd8ee"ee   df      d9ee"ee   dz  ee   dz  f      d:ee"ee"eef      dz  ee"eef      dz  f      ded/ed0ed edz  d!edz  d"ed$edz  d%e	dz  d&e	dz  d'edz  d(edz  d)ed*ed,ed-edef&d;       Z& eee      	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dMd<ee   d=ee   dz  d>ee   dz  d?ee   dz  d@ee"eef      dz  dAee"eef      dz  dedee	z  ez  dee	z  ez  d edz  d!edz  d"ed$edz  d%e	dz  d&e	ez  dz  d'edz  d(edz  d)ed*ed+ed,ed-edBedef0dC       Z'	 	 	 	 	 	 	 	 dNdDeee   z  e
e	e(f   z  e
e	ee(   f   z  ee
e	e(f      z  dee	z  ez  d edz  d!edz  d$edz  d%e	dz  d(edz  d&e	ez  dz  d-edefdEZ)ddej<                  dddfdDe
e	e(f   ez  d edz  d!edz  d/ed$edz  d%e	dz  d(edz  de
fdFZ* xZ+S )OLukeTokenizeraJ  
    Constructs a LUKE tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding.

    This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
    be encoded differently whether it is at the beginning of the sentence (without space) or not:

    ```python
    >>> from transformers import LukeTokenizer

    >>> tokenizer = LukeTokenizer.from_pretrained("studio-ousia/luke-base")
    >>> tokenizer("Hello world")["input_ids"]
    [0, 31414, 232, 2]

    >>> tokenizer(" Hello world")["input_ids"]
    [0, 20920, 232, 2]
    ```

    You can get around that behavior by passing `add_prefix_space=True` when instantiating this tokenizer or when you
    call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.

    <Tip>

    When used with `is_split_into_words=True`, this tokenizer will add a space before each word (even the first one).

    </Tip>

    This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
    this superclass for more information regarding those methods. It also creates entity sequences, namely
    `entity_ids`, `entity_attention_mask`, `entity_token_type_ids`, and `entity_position_ids` to be used by the LUKE
    model.

    Args:
        vocab_file (`str`):
            Path to the vocabulary file.
        merges_file (`str`):
            Path to the merges file.
        vocab (`str` or `dict[str, int]`, *optional*):
            Custom vocabulary dictionary. If not provided, the vocabulary is loaded from `vocab_file`.
        merges (`str` or `list[str]`, *optional*):
            Custom merges list. If not provided, merges are loaded from `merges_file`.
        entity_vocab_file (`str`):
            Path to the entity vocabulary file.
        task (`str`, *optional*):
            Task for which you want to prepare sequences. One of `"entity_classification"`,
            `"entity_pair_classification"`, or `"entity_span_classification"`. If you specify this argument, the entity
            sequence is automatically created based on the given entity span(s).
        max_entity_length (`int`, *optional*, defaults to 32):
            The maximum length of `entity_ids`.
        max_mention_length (`int`, *optional*, defaults to 30):
            The maximum number of tokens inside an entity span.
        entity_token_1 (`str`, *optional*, defaults to `<ent>`):
            The special token used to represent an entity span in a word token sequence. This token is only used when
            `task` is set to `"entity_classification"` or `"entity_pair_classification"`.
        entity_token_2 (`str`, *optional*, defaults to `<ent2>`):
            The special token used to represent an entity span in a word token sequence. This token is only used when
            `task` is set to `"entity_pair_classification"`.
        errors (`str`, *optional*, defaults to `"replace"`):
            Paradigm to follow when decoding bytes to UTF-8. See
            [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
        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.
        add_prefix_space (`bool`, *optional*, defaults to `False`):
            Whether or not to add an initial space to the input. This allows to treat the leading word just as any
            other word. (LUKE tokenizer detect beginning of words by the preceding space).
    	input_idsattention_maskNFvocabmergesentity_vocabc           
         || _         |j                  dd       }|d|v r|j                  d      }|xs i | _        |xs g | _        t	        t        | j                  | j                  d ddd            | _        t        j                  |      | j                  _	        t        j                         | j                  _        ||| _        nB|1t        |d      5 }t        j                  |      | _        d d d        n|d	|d
|d|di| _        ||||fD ]  }|| j                  vst!        d| d       | j                  |   | _        | j                  |   | _        | j                  |   | _        | j                  |   | _        || _        ||dk(  r|| _        n)|dk(  rd
| _        n|dk(  rd| _        nt!        d| d      || _        t1        |t2              rt5        |dd      n|}t1        |t2              rt5        |dd      n|}g }dD ]I  }|j                  |g       xs g D ].  }|j7                  t1        |t8              rt5        d0i |n|       0 K |D ch c]  }t3        |       }}||fD ]4  }t3        |      }||vs|j7                  |       |j;                  |       6 ||d<   |j=                  dd      }|j=                  dd      } |j=                  dd      }!|| _        | | _         |!| _!        |j=                  dd       tE        "|   d0i d|d|d |d!|	d"|d#|d$|
d%|d&|d'|d(|d)|d*t3        |      d+t3        |      d,|d-|d.|d/|d||nd | y # 1 sw Y   lxY wc c}w )1Nr   r!    F)r   r    dropoutcontinuing_subword_prefixend_of_word_suffixfuse_unk)add_prefix_spacezutf-8)encodingr         r   z Specified entity special token `z` is not found in entity_vocab.entity_span_classificationentity_classificationentity_pair_classificationTask z| not supported. Select task from ['entity_classification', 'entity_pair_classification', 'entity_span_classification'] only.)lstriprstrip)extra_special_tokensadditional_special_tokensr2   token_type_ids_pattern	all_zerosspecial_tokens_patterncls_double_sep%token_type_ids_include_special_tokensTclean_up_tokenization_spaceserrors	bos_token	eos_token	unk_token	sep_token	cls_token	pad_token
mask_tokenr(   taskmax_entity_lengthmax_mention_lengthentity_token_1entity_token_2entity_unk_tokenentity_pad_tokenentity_mask_tokenentity_mask2_token )$r(   pop_vocab_mergesr   r   
_tokenizerr   	ByteLevelpre_tokenizerr   decoderr!   openjsonload
ValueErrorentity_unk_token_identity_pad_token_identity_mask_token_identity_mask2_token_idrB   rC   rD   
isinstancestrr   appenddictadd
setdefaultr4   r6   r8   super__init__)#selfr   r    r!   r:   r;   r<   r>   r?   r=   r@   rA   r(   rB   rC   rD   rE   rF   rG   rH   rI   rJ   kwargsr   fentity_special_tokenextra_tokenskeytokenseen	token_strr4   r6   r8   	__class__s#                                     \/opt/pipecat/venv/lib/python3.12/site-packages/transformers/models/luke/tokenization_luke.pyrb   zLukeTokenizer.__init__   so   2 !1 #JJ':DANf$<!::n5Lkr|#kk||*,#%	
 )7(@(@Rb(c%"*"4"4"6 # ,D*'': 1a$(IIaL!1 1
 !! !!1"A	!D &67GIZ\n$o 	 #4+<+<< 67K6LLkl 	 $(#4#45E#F #'#4#45E#F $($5$56G$H!%)%6%67I%J" 	<4#??%6D",,%&D"11%&D"v 7 7 
 #5
 .#. ~eEB 	 .#. ~eEB 	 02H 	_CC,2 _##:eT;RJ$7$7X]^_	_
 )55uE
55$n5 	$EE
I$##E*#		$ *6%& "(!2!23K[!Y!'!2!23KM]!^060A0ABiko0p-&<#&<#5Z2 	8$? 	
	
	
  	
  		

  	
  	
  	
 "	
 .	
 	
 0	
  2	
 ~.	
 ~.	
 .	
  .!	
" 0#	
$  2%	
& *;)B)	
[1 1r 6s   M1!M>1M;token_ids_0token_ids_1returnc                 0    t        j                  | ||      S N)r	    build_inputs_with_special_tokensrc   rn   ro   s      rm   rs   z.LukeTokenizer.build_inputs_with_special_tokens  s     #CCD+Wbcc    already_has_special_tokensc                 4    t        j                  | |||      S )N)rv   )r	   get_special_tokens_mask)rc   rn   ro   rv   s       rm   rx   z%LukeTokenizer.get_special_tokens_mask  s!     #::+{Ga
 	
ru   c                 0    t        j                  | ||      S rr   )r	   $create_token_type_ids_from_sequencesrt   s      rm   rz   z2LukeTokenizer.create_token_type_ids_from_sequences  s     #GGk[fggru   	token_idsskip_special_tokensr9   c                 t    t        |   |f|dd|}||n| j                  }|r| j                  |      }|S )NF)r|   r9   )ra   _decoder9   clean_up_tokenization)rc   r{   r|   r9   rd   textrl   s         rm   r~   zLukeTokenizer._decode  s^     w
+>]b
fl
 ,7 )22 	%
 (--d3Dru   Tr   r   	text_pairentity_spansentity_spans_pairentitiesentities_pairadd_special_tokenspadding
truncation
max_lengthrC   strideis_split_into_wordspad_to_multiple_ofpadding_sidereturn_tensorsreturn_token_type_idsreturn_attention_maskreturn_overflowing_tokensreturn_special_tokens_maskreturn_offsets_mappingreturn_lengthverbosec           	         |j                  d      |j                  d      `||| j                  t        d      t        #|   d$i d|d|d|d|d|	d	|
d
|d|d|d|d|d|d|d|d|d|d|d||S 	 t        |t              }t        |t        t        f      xr. t        |      dk(  xs t        |d   t        t        t        f      }|s|st        d      t        |t              }t        |t        t        f      xr# t        |      dk(  xs t        |d   t              }||s|st        d      t        t        |t        t        f            } | j                  d$||	|
||d|\  }}}
}|r|t        t        ||            n|} |d }!n|t        t        ||            n|}!|d }"n|t        t        ||            n|}" | j                  d$i d| d|"d|!d|d|d|d	|
d|d
|d|d|d|d|d|d|d|d|d|d|d||S  | j                  d$i d|d|d |d!|d"|d#|d|d|d|d	|
d|d
|d|d|d|d|d|d|d|d|d|d|d||S )%Ntext_targettext_pair_targetztext_target and text_pair_target are not supported when using entity-aware encoding. Please use the tokenizer without entities for seq2seq tasks.r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zgtext input must be of type `str` (single example), `list[str]` (batch), or `list[tuple]` (batch pairs).zNtext_pair input must be of type `str` (single example) or `list[str]` (batch).r   r   r   r   r   batch_text_or_text_pairs(batch_entity_spans_or_entity_spans_pairs batch_entities_or_entities_pairspadding_strategytruncation_strategyrC   r   r   r   r   rK   )getrB   NotImplementedErrorra   __call__r[   r\   listtuplelenrV   bool"_get_padding_truncation_strategieszip_batch_encode_plus_encode_plus)$rc   r   r   r   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   rd   is_valid_single_textis_valid_batch_textis_valid_single_text_pairis_valid_batch_text_pair
is_batchedr   r   r   r   r   rl   s$                                      rm   r   zLukeTokenizer.__call__  s   : ::m$0FJJ?Q4R4^'8+?499CX)S 
 7# # $6  	
 & &  %8 $6 *  . '< '< +D ,F  (>!" ,#$  ' *&	P  *$4(e}= 
INEja3e2DE 	 %(;y  %/y#$>!#-i$#G $
	Na@:ilC#@ 	! !%>BZmnn*TD%=9:
 ElDDkDk E
!!1E
 E
A-z6 ENEZtCi,@'A`d$370 ;H:SDX}56Ya 1 #;?8 CTB_D\+<=>eq 9 +4** )A9a 2R $6	
 "2 %8 & #4  %8 $6 *  . '< '<  +D!" ,F#$ (>%& ,'(  + 0 %4$$ # * #4	
 " , $6 "2 %8 & #4  %8 $6 *   .!" '<#$ '<%& +D'( ,F)* (>+, ,-.  1 ru   r   r   c                    |W|U|S|Q| j                   Et        |   di d|d|d|d|d|	d|
d|d|d	|d
|d|d|d|d|d|d|d|d||S |rt        d      |rt        d       | j                  d||||||d|\  }}}}}}| j                  ||||||||j                  |	j                  |
|||||d||||||      S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Hreturn_offset_mapping is not available when using entity-aware encoding.7is_split_into_words is not supported in this tokenizer.r   r   r   r   r   r   T)pair_ids
entity_idspair_entity_idsentity_token_spanspair_entity_token_spansr   r   r   r   rC   r   r   r   r   prepend_batch_axisr   r   r   r   r   r   rK   )rB   ra   r   r   _create_input_sequenceprepare_for_modelvalue) rc   r   r   r   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   rd   	first_ids
second_idsfirst_entity_idssecond_entity_idsfirst_entity_token_spanssecond_entity_token_spansrl   s                                   rm   r   zLukeTokenizer._encode_plusi  s   :  !) %		! 7' # $6 "2	
 %8 &  %8 $6 *  . '< '< +D ,F  (>!" ,#$  ' , "%&pqq%&_`` (D'' 
'%/
 
	
$% %%'-7$=1$***00!/1%)#"7"7&?'A'- & 
 	
ru   r   r   r   c                    ||| j                   |r;t        |d   t        t        f      r"t	        | \  }}t        |      }t        |      }n|}d }t        ,|   di d|d|d|d|d|d|d|	d	|
d
|d|d|d|d|d|d|d|d|d|d|j                  d| j                        |S |rt        d      |
rt        d      g }g }g }t        |      D ]  \  }}t        |t        t        f      s|d }}n|\  }}d\  }} |$||   }!|!rt        |!d   t              r|!d } }n|!\  }} d\  }"}#|0||   }$t        |$      dkD  rt        |$d   t              r|$\  }"}#n|$d }#}" | j                  d|||| |"|#d|\  }%}&}'}(})}*|j                  |%|&f       |j                  |'|(f       |j                  |)|*f        | j                  |||||||||	|||||||||      }+t!        |+      S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   split_special_tokensr   r   NNr   )batch_entity_ids_pairsbatch_entity_token_spans_pairsr   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   rK   )rB   r[   r   r   r   ra   r   r   r   r   	enumerater\   r   r   r]   _batch_prepare_for_modelr   )-rc   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   rd   texts
text_pairsr   r   r   indextext_or_text_pairr   r   r   r   entities_or_entities_pairsr   r   "entity_spans_or_entity_spans_pairsr   r   r   r   r   r   batch_outputsrl   s-                                               rm   r   z LukeTokenizer._batch_encode_plus  s7   8 5<08		!
 (J7OPQ7RUZ\`Ta,b$')A$B!zU!*-
 1!
 7' $ $6 "2	
 %8 &  %8 $6 *  . '< '< +D ,F  (>!" ,#$  %& &,ZZ0FHaHa%b) . "%&pqq%&_`` 	
(12J(K +	]$E$/$?"3Ti"3i&0#Hm/;-Me-T*-!"<Q"?E2Ld-2L/-.8+L+7C5]^c5d29:Q>:6q94D 7Y3L"36XZ^"3L ,++ #!+)"3  !() i45/1BCD%%'?AZ&[\W+	]Z 55#-+=1- 3!/1%"7"7&?'A')% 6 
* ]++ru   c                 j   t        |t              st        d      t        |      dkD  rt        |d   t              st        d      |jt        |t              st        d      t        |      dkD  rt        |d   t              st        d      t        |      t        |      k7  rt        d      y y )Nz&entity_spans should be given as a listr   z_entity_spans should be given as a list of tuples containing the start and end character indicesz7If you specify entities, they should be given as a listzGIf you specify entities, they should be given as a list of entity nameszJIf you specify entities, entities and entity_spans must be the same length)r[   r   	TypeErrorr   r   rV   r\   )rc   r   r   s      rm   _check_entity_input_formatz(LukeTokenizer._check_entity_input_formatg  s    ,-DEE":l1ou+Mq  h- !Z[[8}q HQK)E !jkk8}L 11 !mnn 2  ru   c                 L     fdfd}d\  }	}
d\  }}d\  }} j                   |	 |      }	nm j                  ||        |||      \  }	}| j                  gt        |      z  }n3|D cg c](  } j                  j                  | j                        * }}||
 |      }
n j                  ||        |||      \  }
}| j                  gt        |      z  }n|D cg c](  } j                  j                  | j                        * }}nu j                   dk(  rt        |t              r!t        |      dk(  rt        |d   t              st        d       j                  g} |||      \  }	}|d   \  }}|	d |  j                  d   gz   |	|d  z   }	|	d |  j                  d   gz   |	|d  z   }	||dz   fg}nǉ j                   d	k(  r-t        |t              r4t        |      dk(  r&t        |d   t              rt        |d   t              st        d
      |\  }} j                   j                  g} |||      \  }	}|\  }}| j                  d   f| j                  d   fg}|d   |d   k  r4|d   |d   dz   f|d<   |d   dz   |d   dz   f|d<   |j                          n#|d   dz   |d   dz   f|d<   |d   |d   dz   f|d<   |D ]&  \  \  }}}|	d | |gz   |	|d  z   }	|	d | |gz   |	|d  z   }	( n j                   dk(  rbt        |t              r!t        |      dkD  rt        |d   t              st        d       |||      \  }	} j                  gt        |      z  }nt        d j                    d      |	|
||||fS c c}w c c}w )Nc                 V    j                   j                  | d      }|j                  S )NF)r   )rO   encodeids)r   r)   rc   s     rm   get_input_idsz;LukeTokenizer._create_input_sequence.<locals>.get_input_ids  s&    --du-MH<<ru   c                 x   |
 |       d fS d}g }d gt        |      z  }t        t        t        j                  |             }i }|D ]<  }|}|dkD  r| |dz
     dk(  r|dz  }||k7  r| | ||       z  }|}t        |      ||<   > | | |d        z  }|D 	
cg c]  \  }	}
||	   ||
   f }}	}
||fS c c}
}	w )Nr   r*    )r   sorted	frozenset	itertoolschain)r   r   curr   r   split_char_positionschar_pos2token_possplit_char_positionorig_split_char_position
char_startchar_endr   s              rm   $get_input_ids_and_entity_token_spanszRLukeTokenizer._create_input_sequence.<locals>.get_input_ids_and_entity_token_spans  s'   #$T*D00CI"&#l*;!;#))IOO\4R*S#T !#'; 	N#+>('!+5H15L0MQT0T'1,'--tC8K/L!MMI-C?B9~"#;<	N tCDz22I lx"SgS]_g#J/1CH1MN" " 000	"s   B6r   r-   r*   r   zsEntity spans should be a list containing a single tuple containing the start and end character indices of an entityr+   r.   zEntity spans should be provided as a list of two tuples, each tuple containing the start and end character indices of an entity   r,   z{Entity spans should be provided as a list of tuples, each tuple containing the start and end character indices of an entityr/   z not supported)rB   r   rY   r   r!   r   rW   r[   r   r   rV   extra_special_tokens_idsrZ   reverse)rc   r   r   r   r   r   r   rd   r   r   r   r   r   r   r   entityentity_token_startentity_token_end	head_span	tail_spanhead_token_spantail_token_span!token_span_with_special_token_idsspecial_token_idr   s   `                       @rm   r   z$LukeTokenizer._create_input_sequencey  s   	 
	1< !+	:.8++>H; ";99#)$/	//,G6Z[_am6n3	3#(,(A(A'BSEV'V$nv'wdj(9(9(=(=fdF^F^(_'w$'w$$,!.y!9J33MCTU<`!#4=9J 9 %,-1-F-F,G#N_J`,`) cp-X^D--11&$:R:RS-) - YY11|T2s<7HA7MR\]ijk]lnsRt R  !% 9 9:2VW[]i2j/I/ 4LA3N0 0++,0M0Ma0P/QQT]^n^oTpp  --.$2O2OPQ2R1SSV_`r`sVtt  *<=MPQ=Q(R'S$YY66<.%*|A6|A6 ] 
 $0 Iy $ 9 94;U;UV2VW[]i2j/I//G,O_ $"?"?"BC $"?"?"BC1- q!OA$66/>q/A?STCUXYCY.Z(+/>q/AA/EWXGY\]G].^(+199;/>q/AA/EWXGY\]G].^(+/>q/A?STCUXYCY.Z(+Lm qH6#%58H%&7'78<L;MMPYZjZkPll	%&9'9:>N=OOR[\n\oRpp	q YY66|T2s<7H17LQ[\hij\kmrQs ] 
 3WW[]i2j/I/ $ 9 9:S=NN uTYYK~>?? $%
 	
g (x-s   1-N.-N!batch_ids_pairsr   r   c                    i }t        |||      D ]  \  }}}|\  }}|\  }}|\  }}| j                  |||||||t        j                  j                  |j                  |||	ddd||||dd|      }|j                         D ]"  \  }}||vrg ||<   ||   j                  |       $  | j                  ||j                  ||
||      }t        ||      }|S )a  
        Prepares a sequence of input id, or a pair of sequences of inputs ids so that it can be used by the model. It
        adds special tokens, truncates sequences if overflowing while taking into account the special tokens and
        manages a moving window (with user defined stride) for overflowing tokens


        Args:
            batch_ids_pairs: list of tokenized input ids or input ids pairs
            batch_entity_ids_pairs: list of entity ids or entity ids pairs
            batch_entity_token_spans_pairs: list of entity spans or entity spans pairs
            max_entity_length: The maximum length of the entity sequence.
        NF)r   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   tensor_type)	r   r   r   
DO_NOT_PADr   itemsr]   padr   ) rc   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   r   entity_token_span_pairsr   r   r   r   r   r   outputsrh   r   s                                    rm   r   z&LukeTokenizer._batch_prepare_for_model  s>   F >A35S?
 "	1:Iz#: %.!Iz2<//BY?$&?,,+ 1#;(A#5'2288.44%"3#'!&+&;*C+E+##(- - G2 &mmo 1
Um+)+M#&c"))%01?"	1H $**!1%"7 ! 
 &mPru   r   r   r   r   r   r   r   c           	      @	    | j                   d||	|
||d|\  }}}
}t        |du      }t        |      }|rt        |      nd}|r|st        d      |r |t        j
                  k(  r|t        d      |d| j                  v }|d| j                  v }i }||z   |r| j                  |      ndz   }g } |t        j                  k7  r$|
r"||
kD  r| j                  ||||
z
  ||	      \  }}} |r| |d
<   ||
z
  |d<   |r5| j                  ||      }!| j                  ||      }"d}#t        |      dz   }$n9|r||z   n|}!dgt        |      z  |rdgt        |      z  ng z   }"d}#t        |      }$|!|d<   |r|"|d<   |r*|r| j                  ||      |d<   ndgt        |!      z  |d<   |s| j                  }|ed}%d}&t        ||      D '(cg c]  \  }'}(|(d   t        |      k  s|' })}'}(|D (cg c]  }(|(d   t        |      k  s|( }*}(|%t        |)      z  }%|&t        |      t        |)      z
  z  }&d\  }+},|xt        ||      D '(cg c]  \  }'}(|(d   t        |      k  r|' }+}'}(|D (cg c]  }(|(d   t        |      k  s|( },}(|%t        |+      z  }%|&t        |      t        |+      z
  z  }&|&dk7  rt        j!                  |& d       |t        j                  k7  r@|%|kD  r;| j                  |)|+|%|z
  ||	      \  })}+}-|*dt        |)       }*|,|,dt        |+       },|r-|d<   |%|z
  |d<   |+r|)|+z   n|)}.t#        |.      |d<   g }/g }0g }1|*|#f|,|$ffD ]  \  }2}3|2	|2D ]  \  }4}5|4|3z  }4|5|3z  }5t#        t%        |4|5            d| j&                   }6|6dg| j&                  |5z
  |4z   z  z  }6|/j)                  |6       |0j)                  |4       |1j)                  |5dz
           |/|d<   | j*                  dk(  r
|0|d<   |1|d<   |rdgt        |d         z  |d<   | j-                  |d   |
|       |t.        j0                  k7  s|r"| j3                  ||
||j4                  |||      }|rt        |d         |d<   t7        |||      }7|7S c c}(}'w c c}(w c c}(}'w c c}(w )ah  
        Prepares a sequence of input id, entity id and entity span, or a pair of sequences of inputs ids, entity ids,
        entity spans so that it can be used by the model. It adds special tokens, truncates sequences if overflowing
        while taking into account the special tokens and manages a moving window (with user defined stride) for
        overflowing tokens. Please Note, for *pair_ids* different than `None` and *truncation_strategy = longest_first*
        or `True`, it is not possible to return overflowing tokens. Such a combination of arguments will raise an
        error.

        Args:
            ids (`list[int]`):
                Tokenized input ids of the first sequence.
            pair_ids (`list[int]`, *optional*):
                Tokenized input ids of the second sequence.
            entity_ids (`list[int]`, *optional*):
                Entity ids of the first sequence.
            pair_entity_ids (`list[int]`, *optional*):
                Entity ids of the second sequence.
            entity_token_spans (`list[tuple[int, int]]`, *optional*):
                Entity spans of the first sequence.
            pair_entity_token_spans (`list[tuple[int, int]]`, *optional*):
                Entity spans of the second sequence.
            max_entity_length (`int`, *optional*):
                The maximum length of the entity sequence.
        r   Nr   zAsking to return token_type_ids while setting add_special_tokens to False results in an undefined behavior. Please set add_special_tokens to True or set return_token_type_ids to None.zNot possible to return overflowing tokens for pair of sequences with the `longest_first`. Please select another truncation strategy than `longest_first`, for instance `only_second` or `only_first`.token_type_idsr   )pair)r   num_tokens_to_remover   r   overflowing_tokensnum_truncated_tokensr*   r   r   special_tokens_maskr   zb entities are ignored because their entity spans are invalid due to the truncation of input tokensoverflowing_entitiesnum_truncated_entitiesr   entity_position_idsr,   entity_start_positionsentity_end_positionsentity_token_type_ids)r   rC   r   r   r   r   length)r   r   rK   )r   r   r   rV   r   LONGEST_FIRSTmodel_input_namesnum_special_tokens_to_addDO_NOT_TRUNCATEtruncate_sequencesrs   rz   rx   rC   r   loggerwarningr   rangerD   r]   rB   &_eventual_warn_about_too_long_sequencer   r   r   r   r   )8rc   r   r   r   r   r   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   rd   r   r   r   len_idslen_pair_idsencoded_inputs	total_lenr   sequencer   entity_token_offsetpair_entity_token_offsettotal_entity_lennum_invalid_entitiesent_idspanvalid_entity_idsvalid_entity_token_spansvalid_pair_entity_idsvalid_pair_entity_token_spansr  final_entity_idsr  r  r  token_spansoffsetstartendposition_idsr   s8                                                           rm   r   zLukeTokenizer.prepare_for_modele  sQ   l ElDDkDk E
!!1E
 E
A-z6 HD()c((,s8}! );5  &#'9'G'GG$>  !($48N8N$N! ($48N8N$N! l*[md.L.LRV.L.Wstu	  "4"D"DDXadnXn040G0G!%.%;$7 1H 1-C- %3EN/05>5KN12 <<S(KH!FFsHUN"#'*3x!|$)-sX~3HS3s8^dsS]/BPRSN"#'*3x$ '/{# /=N+,%!8<8T8TUXZb8c459:c(m8K45 ! $ 6 6! #$ ;>zK];^v<64bfghbimpqtmubuvv9K'ctTUwZ]^aZbOb'c$'c$4 55 C
Oc:J6K$KK CM@!#@* ),O=T(U)$Aw#h-/ )% )
 CZ0v$]abc]dhklthu]u0v-0v C(=$>> $O(<sCX?Y(YY$#q(+, -2 2
 #&8&H&HHM]`qMqPTPgPg$2)9<M)M(;! Qh QM "79M ,DD[cJZF[+\(0<4QRnTWXmTn4o1(9M56;KN_;_78K`/2GGfv+/0@+AN<("$%'"#% )+>?.0HI( =#V *&1 =
sv'+E%,='>?XAXAX'Y$0G0G#0MPU0U(VV+22<@.55e<,33C!G<== 5HN01yy88;Q789M56$;<#NS_D`@a:a67 	33N;4OQ[]de 999=R!XX%"3(..#5)&; & N '*>++F'GN8$%K]
 s  w'c)
 1ws*   R
"R
-RRR,RRr  c
           
         t        |t        t        f      rGt        |d   t              r4|d   j	                         D 
ci c]  }
|
|D cg c]  }||
   	 c} }}
}| j
                  d   |vr5t        d| j
                  d    dt        |j	                                      || j
                  d      }|s	|rg |d<   |S |d   }t        |t        t        f      r@d}t        ||         dk(  r|dz  }t        ||         dk(  r|t        |      k  r||   d   }t        |t        t        t        f      stt        |      r|dn|}n<t        |t        j                        r|dn|}nt        d| d	t        |       d
      |j                         D ]  \  }
}t        |      ||
<    | j                  |||	      \  }}}}|| j                   }|| j
                  d      }|r>t        |d   t        t        f      s%| j#                  |||||||      }t%        ||      S t        |      t'        fd|j)                         D              rt        d      |t*        j,                  k(  r=t/        d |D              }d|v rt/        d |d   D              nd}t*        j0                  }i }t3              D ]u  }|j                         D ci c]  \  }}|||    }}}| j#                  |||||||      }|j                         D ]"  \  }
}|
|vrg ||
<   ||
   j5                  |       $ w t%        ||      S c c}w c c}}
w c c}}w )a  
        Pad a single encoded input or a batch of encoded inputs up to predefined length or to the max sequence length
        in the batch. Padding side (left/right) padding token ids are defined at the tokenizer level (with
        `self.padding_side`, `self.pad_token_id` and `self.pad_token_type_id`) .. note:: If the `encoded_inputs` passed
        are dictionary of numpy arrays or PyTorch tensors  the result will use the same type unless
        you provide a different tensor type with `return_tensors`. In the case of PyTorch tensors, you will lose the
        specific device of your tensors however.

        Args:
            encoded_inputs ([`BatchEncoding`], list of [`BatchEncoding`], `dict[str, list[int]]`, `dict[str, list[list[int]]` or `list[dict[str, list[int]]]`):
                Tokenized inputs. Can represent one input ([`BatchEncoding`] or `dict[str, list[int]]`) or a batch of
                tokenized inputs (list of [`BatchEncoding`], *dict[str, list[list[int]]]* or *list[dict[str,
                list[int]]]*) so you can use this method during preprocessing as well as in a PyTorch Dataloader
                collate function. Instead of `list[int]` you can have tensors (numpy arrays, or PyTorch tensors),
                see the note above for the return type.
            padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`):
                 Select a strategy to pad the returned sequences (according to the model's padding side and padding
                 index) among:

                - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
                  sequence if provided).
                - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
                  acceptable input length for the model if that argument is not provided.
                - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
                  lengths).
            max_length (`int`, *optional*):
                Maximum length of the returned list and optionally padding length (see above).
            max_entity_length (`int`, *optional*):
                The maximum length of the entity sequence.
            pad_to_multiple_of (`int`, *optional*):
                If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
                the use of Tensor Cores on NVIDIA hardware with compute capability `>= 7.5` (Volta).
            padding_side:
                The side on which the model should have padding applied. Should be selected between ['right', 'left'].
                Default value is picked from the class attribute of the same name.
            return_attention_mask (`bool`, *optional*):
                Whether to return the attention mask. If left to the default, will return the attention mask according
                to the specific tokenizer's default, defined by the `return_outputs` attribute. [What are attention
                masks?](../glossary#attention-mask)
            return_tensors (`str` or [`~utils.TensorType`], *optional*):
                If set, will return tensors instead of list of python integers. Acceptable values are:

                - `'pt'`: Return PyTorch `torch.Tensor` objects.
                - `'np'`: Return Numpy `np.ndarray` objects.
            verbose (`bool`, *optional*, defaults to `True`):
                Whether or not to print more information and warnings.
        r   zRYou should supply an encoding or a list of encodings to this method that includes z, but you provided r   r*   ptnpztype of z
 unknown: z6. Should be one of a python, numpy, or pytorch object.)r   r   r   )r   rC   r   r   r   r   r   c              3   :   K   | ]  }t        |      k7    y wrr   r   ).0v
batch_sizes     rm   	<genexpr>z$LukeTokenizer.pad.<locals>.<genexpr>  s     Es1v#Es   zLSome items in the output dictionary have a different batch size than others.c              3   2   K   | ]  }t        |        y wrr   r,  r-  inputss     rm   r0  z$LukeTokenizer.pad.<locals>.<genexpr>  s     FVS[F   r   c              3   2   K   | ]  }t        |        y wrr   r,  r2  s     rm   r0  z$LukeTokenizer.pad.<locals>.<genexpr>  s     KFCKKr4  )r[   r   r   r   keysr  rV   r   intr   r*  ndarraytyper   r   r   rC   _padr   anyvaluesr   LONGESTmax
MAX_LENGTHr  r]   )rc   r  r   r   rC   r   r   r   r   r   rh   examplerequired_inputfirst_elementr   r   r   _r   ikr.  r3  r   r/  s                           @rm   r   zLukeTokenizer.padM  s   B ntUm4NSTDUW^9_[ijk[l[q[q[stTWc#OWGCL#OOtNt !!!$N:!!%!7!7!: ;;NtTbTgTgTiOjNkm 
 ((>(>q(AB$35/0!! 'q)mdE]3EnU+,1
 nU+,1s>** .u 5a 8-#tU);<}-)7)?^M2::6)7)?^ }oZ]8K7L MK K 
 -224 7
U&/&6s#7 .2-T-T
G .U .
*!Z $ $ 6 6'(>(>q(AB*^A->u"N!YY%"3!1#5)&; ' N !^LL(
E^-B-B-DEEkll666F~FFJO[_mOmKn\.JKKst   /99z" 	1A*8*>*>*@A$!Qa1gAFAii%"3!1#5)&;   G &mmo 1
Um+)+M#&c"))%01	1" ]GG{ $PtZ Bs   
ML?MM
?Mc                     t        d|v       }|d| j                  v }|t        j                  k(  rt	        |d         }|rt	        |d         }||||z  dk7  r||z  dz   |z  }|r||||z  dk7  r||z  dz   |z  }|t        j
                  k7  xr( t	        |d         |k7  xs |xr t	        |d         |k7  }	|rd|vrdgt	        |d         z  |d<   |r|rd|vrdgt	        |d         z  |d<   |	r|t	        |d         z
  }
||n| j                  }|r|t	        |d         z
  }|dk(  r|r |d   dg|
z  z   |d<   |r|d   dgz  z   |d<   d|v r |d   dg|
z  z   |d<   |r|d	   dgz  z   |d	<   d
|v r|d
   dg|
z  z   |d
<   |d   | j                  g|
z  z   |d<   |rc|d   | j                  gz  z   |d<   |d   dg| j                  z  g|z  z   |d<   | j                  dk(  r|d   dg|z  z   |d<   |d   dg|z  z   |d<   |S |dk(  r|r dg|
z  |d   z   |d<   |rdgz  |d   z   |d<   d|v r dg|
z  |d   z   |d<   |rdgz  |d	   z   |d	<   d
|v rdg|
z  |d
   z   |d
<   | j                  g|
z  |d   z   |d<   |rc| j                  gz  |d   z   |d<   dg| j                  z  g|z  |d   z   |d<   | j                  dk(  rdg|z  |d   z   |d<   dg|z  |d   z   |d<   |S t        dt        |      z         |S )ap  
        Pad encoded inputs (on left/right and up to predefined length or max length in the batch)


        Args:
            encoded_inputs:
                Dictionary of tokenized inputs (`list[int]`) or batch of tokenized inputs (`list[list[int]]`).
            max_length: maximum length of the returned list and optionally padding length (see below).
                Will truncate by taking into account the special tokens.
            max_entity_length: The maximum length of the entity sequence.
            padding_strategy: PaddingStrategy to use for padding.


                - PaddingStrategy.LONGEST Pad to the longest sequence in the batch
                - PaddingStrategy.MAX_LENGTH: Pad to the max length (default)
                - PaddingStrategy.DO_NOT_PAD: Do not pad
                The tokenizer padding sides are defined in self.padding_side:


                    - 'left': pads on the left of the sequences
                    - 'right': pads on the right of the sequences
            pad_to_multiple_of: (optional) Integer if set will pad the sequence to a multiple of the provided value.
                This is especially useful to enable the use of Tensor Core on NVIDIA hardware with compute capability
                `>= 7.5` (Volta).
            padding_side:
                The side on which the model should have padding applied. Should be selected between ['right', 'left'].
                Default value is picked from the class attribute of the same name.
            return_attention_mask:
                (optional) Set to False to avoid returning attention mask (default: set to model specifics)
        r   r   r   r   r*   entity_attention_maskrightr   r  r  r  r  r,   r  r  leftzInvalid padding strategy:)r   r  r   r=  r   r   r   pad_token_idrX   rD   rB   rV   r\   )rc   r  r   rC   r   r   r   r   entities_providedneeds_to_be_padded
differenceentity_differences               rm   r:  zLukeTokenizer._pad  s   P !!?@ !($48N8N$N!666^K89J $'|(D$E!!&8&D*WiJimnJn%);;q@DVVJ !-"."%771<"37I"IQ!NRd d-1K1KK 
{+,
: ^!\c.*F&GK\&\ 	 !%5^%K01sS9T5U/UN+,!6;RZh;h78cC|@\<]6]N23#c.*E&FFJ+7+C<IZIZL $5N<<X8Y$Y!w&(7EFV7W[\Z]`jZj7jN#34(*+BCqcL]F]] ''>? $~57EFV7W[\Z]`jZj7jN#34(*+BCqcL]F]] ''>? )N:<JK`<aefdgjtdt<tN#89.<[.ITM^M^L_blLl.l{+$&|48P8P7QTe7ee #<0 ''<="H_H_A_@`ct@tt ##89 yy$@@*+CDsM^G^^ ''?@ ++ABaSK\E\\ ''=>J C '(89sZ7G.YiJj7jN#34(CD#HYBY\j3] C'>? $~589sZ7G.YiJj7jN#34(CD#HYBY\j3] C'>? )N:=>C*<L~^sOt<tN#89/3/@/@.AJ.NQ_`kQl.l{+$484L4L3MPa3adr$e 4N<0 t666=)=*,:;P,Q=RN#89 yy$@@DE3IZCZ]k4^ D'?@ CDGXAX[i2\ B'=>  !!<s<?P!PQQru   )NNNreplace<s></s>rQ  rP  z<unk>z<pad>z<mask>FN       z<ent>z<ent2>z[UNK]z[PAD]z[MASK]z[MASK2]rr   )NF)FN)NNNNNTFNNNr   FNNNNNFFFFT)NNNNN)NNNNNTFNNNr   NNNNNFFFFTF)TNNNNNNT),__name__
__module____qualname____doc__VOCAB_FILES_NAMESvocab_files_namesr  r   modelr\   r^   r7  r   rb   rs   r   rx   rz   r~   r   r
   'ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRINGr   EntitySpanInputEntityInputr   r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r:  __classcell__)rl   s   @rm   r   r      s   aF *$&67E .2)-15  "$-V
T#s(^#d*V
 d3i$&V
 Dj4'$.	V
r GKd9d379t3Cd	cd pu
9
379t3C
hl
	c
 GKh9h379t3Ch	ch %*48	c? " '+Tk	 
* /1XY 9=GKLP;?@D#'056:!%(,+0)-#'26-1-1*/+0',#1}$y/)} tI.5} &_(==D	}
 +T/-BBTI} [ 11D8} #T+%66=} !} o-} 3J!33} $J} :} } "D[}  $J}  Dj!}" j(4/#}$  $d{%}&  $d{'}( $()}* %)+}, !%-}. /}0 1}4 
5} Z}D '+/348'+,0#',;,F,F2D2T2T!%(,+0)-#'26-1-1*/+0',#1i
i
 t#i
 &,	i

 +T1i
 $i
 #T)i
 !i
 *i
 0i
 $Ji
 :i
 i
 "D[i
  $Ji
  Dj!i
" j(4/#i
$  $d{%i
&  $d{'i
( $()i
* %)+i
, !%-i
. /i
0 1i
4 
5i
` mq#',;,F,F2D2T2T!%(,+0)-#'26-1-1*/+0',#/Q,"&y/D4G"GQ, 372G
u_o56
738
3Q, +/{*;d5VaIaCb>c*cfj*jQ, !Q, *Q, 0Q, $JQ, :Q, Q, "D[Q,  $JQ, DjQ,  j(4/!Q,"  $d{#Q,$  $d{%Q,& $('Q,( %))Q,* !%+Q,, -Q,. /Q,2 
3Q,fo;3E oUdgkUk o* '+'+,0/348U
U
 t#U
 $	U

 #T)U
 &,U
 +T1U
 
tT4tT1	2U
n /1XY $(,;,F,F2D2T2T!%(,)-#'%)-1-1*/+0#'ReDItO45R !%U49t+;T#Y=M+M%N OR )-U4c3h3H43OQUV[\_ad\dVeQfimQm3m-n(o	R
 !R *R 0R $JR :R R  $JR DjR d
R  $d{R  $d{R  $(!R" %)#R$ %R& 'R( 
)R ZRh /1XY &*'+,0;?@D#'056:!%(,)-#'26-1-1*/+0',##(1e#Ye s)d"e I$	e
 cT)e !sCx1D8e "&eCHo!6!=e !e o-e 3J!33e $Je :e e  $Je Dje  j(4/!e"  $d{#e$  $d{%e& $('e( %))e* !%+e, -e. /e0 !1e4 
5e Ze\ 15!%(,)-#'-126`H%
}

sL 
!" sD&&
'( tC%&
'	(`H o-`H $J`H :`H  $J`H Dj`H  $d{`H j(4/`H `H 
`HJ "&(,,;,F,F)-#'-1NS,./-?N $JN :	N
 *N  $JN DjN  $d{N 
Nru   r   )/rW  r   rT   collections.abcr   numpyr*  
tokenizersr   r   r   tokenizers.modelsr   tokenization_pythonr	   tokenization_utils_baser
   r   r   r   r   r   r   r   r   r   tokenization_utils_tokenizersr   utilsr   r   r   
get_loggerrT  r  r   r7  
EntitySpanr   r\  r\   Entityr]  rX  r[  r   __all__rK   ru   rm   <module>rk     s    %   #  : : ! 6   ? A A 
		H	%38_
z"	6l , I+ 'Xz% zz/ 
ru   