Ë
    ÜÓ^jN  ã                   óf   — d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
 e
 G d„ de«      «       ZdgZy)	z
Processor class for MarkupLM.
é   )Ú
TensorType)ÚProcessorMixin)ÚBatchEncodingÚPaddingStrategyÚTruncationStrategy)Úauto_docstringc                    óÔ   ‡ — e Zd ZdZˆ fd„Ze	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddedeez  ez  deez  e	z  de
dz  de
d	e
dz  d
edz  dedz  dedededededeez  dz  defd„«       Zˆ xZS )ÚMarkupLMProcessorTc                 ó&   •— t         ‰| �  ||«       y )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizerÚ	__class__s      €ú{/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/markuplm/processing_markuplm.pyr   zMarkupLMProcessor.__init__   s   ø€ Ü‰ÑÐ*¨IÕ6ó    NÚadd_special_tokensÚpaddingÚ
truncationÚ
max_lengthÚstrideÚpad_to_multiple_ofÚreturn_token_type_idsÚreturn_attention_maskÚreturn_overflowing_tokensÚreturn_special_tokens_maskÚreturn_offsets_mappingÚreturn_lengthÚverboseÚreturn_tensorsÚreturnc                 ó¬  — | j                   r:|€t        d«      ‚|€|€|�t        d«      ‚| j                  |«      }|d   }|d   }n|�t        d«      ‚|�|€t        d«      ‚|�| j                   rt        |t        «      r|g} | j
                  di d|�|n|“d	|�|nd“d|“d
|“d|“d|“d|“d|	“d|
“d|“d|“d|“d|“d|“d|“d|“d|“d|“|¤Ž}|S )a‡  
        html_strings (`str` or `list[str]`, *optional*):
            Raw HTML strings to parse and process. When `parse_html=True` (default), these strings are parsed
            to extract nodes and xpaths automatically. If provided, `nodes`, `xpaths`, and `node_labels` should
            not be provided. Required when `parse_html=True`.
        nodes (`list[list[str]]`, *optional*):
            Pre-extracted HTML nodes as a list of lists, where each inner list contains the text content of nodes
            for a single document. Required when `parse_html=False`. Should not be provided when `parse_html=True`.
        xpaths (`list[list[str]]`, *optional*):
            Pre-extracted XPath expressions corresponding to the nodes. Should be a list of lists with the same
            structure as `nodes`, where each XPath identifies the location of the corresponding node in the HTML
            tree. Required when `parse_html=False`. Should not be provided when `parse_html=True`.
        node_labels (`list[list[int]]`, *optional*):
            Labels for the nodes, typically used for training or fine-tuning tasks. Should be a list of lists
            with the same structure as `nodes`, where each label corresponds to a node. Optional and only used
            when `parse_html=False`.
        questions (`str` or `list[str]`, *optional*):
            Question strings for question-answering tasks. When provided, the tokenizer processes questions
            as the first sequence and nodes as the second sequence (text_pair). If a single string is provided,
            it is converted to a list to match the batch dimension of the parsed HTML.
        NzDMake sure to pass HTML strings in case `parse_html` is set to `True`zUPlease don't pass nodes, xpaths nor node labels in case `parse_html` is set to `True`ÚnodesÚxpathsz@You have passed HTML strings but `parse_html` is set to `False`.zIMake sure to pass nodes and xpaths in case `parse_html` is set to `False`ÚtextÚ	text_pairÚnode_labelsr   r   r   r   r   r   r   r   r   r   r   r   r    r!   © )Ú
parse_htmlÚ
ValueErrorr   Ú
isinstanceÚstrr   )r   Úhtml_stringsr$   r%   r(   Ú	questionsr   r   r   r   r   r   r   r   r   r   r   r   r    r!   ÚkwargsÚfeaturesÚencoded_inputss                          r   Ú__call__zMarkupLMProcessor.__call__   s‡  € ð\ �?Š?ØÐ#Ü Ð!gÓhÐhàÐ  FÐ$6¸+Ð:QÜ Økóð ð ×-Ñ-¨lÓ;ˆHØ˜WÑ%ˆEØ˜hÑ'‰FàÐ'Ü Ð!cÓdÐdØˆ}  Ü Ð!lÓmÐmð Ð  T§_¢_Ü˜)¤SÔ)Ø&˜K�	à'˜Ÿ™ò 
Ø'Ð3‘¸øð
à(Ð4‘e¸$øð
ñ ð
ñ $ð	
ñ
  2ð
ñ ð
ñ "ð
ñ "ð
ñ ð
ñ  2ð
ñ #8ð
ñ #8ð
ñ '@ð
ñ (Bð
ñ $:ð
ñ  (ð!
ñ" ð#
ñ$ *Øñ'
ˆð, Ðr   )NNNNNTFNNé    NNNFFFFTN)Ú__name__Ú
__module__Ú__qualname__r*   r   r   Úboolr-   r   r   Úintr   r   r3   Ú__classcell__)r   s   @r   r
   r
      s0  ø„ à€Jô7ð ð ØØØØØ#'Ø05Ø6:Ø!%ØØ)-Ø-1Ø-1Ø*/Ø+0Ø',Ø#ØØ26ñ)Zð !ðZð ˜‘˜oÑ-ðZð ˜3‘JÐ!3Ñ3ðZð ˜$‘JðZð ðZð   $™JðZð  $ d™{ðZð  $ d™{ðZð $(ðZð  %)ð!Zð" !%ð#Zð$ ð%Zð& ð'Zð( ˜jÑ(¨4Ñ/ð)Zð, 
ò-Zó ôZr   r
   N)Ú__doc__Ú
file_utilsr   Úprocessing_utilsr   Útokenization_utils_baser   r   r   Úutilsr   r
   Ú__all__r)   r   r   ú<module>rA      sD   ðñõ %Ý .ß YÑ YÝ #ð ôa˜ó aó ðaðH Ð
�r   