§
    ‚ŠtjN  ã                   ót   — 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dS )	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                 óL   •— t          ¦   «                              ||¦  «         d S )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizerÚ	__class__s      €ún/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/markuplm/processing_markuplm.pyr   zMarkupLMProcessor.__init__   s$   ø€ Ý‰Œ×ÒÐ*¨IÑ6Ô6Ð6Ð6Ð6ó    NFé    Ú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         rL|€t          d¦  «        ‚|€|€|�t          d¦  «        ‚|                      |¦  «        }|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ß  € ð\ Œ?ð 	nØÐ#Ý Ð!gÑhÔhÐhàÐ  FÐ$6¸+Ð:QÝ Økñô ð ð ×-Ò-¨lÑ;Ô;ˆHØ˜WÔ%ˆEØ˜hÔ'ˆFˆFàÐ'Ý Ð!cÑdÔdÐdØˆ}  Ý Ð!lÑmÔmÐmð Ð  T¤_Ð Ý˜)¥SÑ)Ô)ð (Ø&˜K�	à'˜œð 
ð 
ð 
Ø'Ð3��¸øð
à(Ð4�e�e¸$øð
ð �6ð
ð $˜ð	
ð
  2Ð1ð
ð �Gð
ð "�zð
ð "�zð
ð �6ð
ð  2Ð1ð
ð #8Ð"7ð
ð #8Ð"7ð
ð '@Ð&?ð
ð (BÐ'Að
ð $:Ð#9ð
ð  (˜-ð!
ð" �Gð#
ð$ *˜>Øð'
ð 
ˆð, Ðr   )NNNNNTFNNr   NNNFFFFTN)Ú__name__Ú
__module__Ú__qualname__r+   r   r   Úboolr.   r   r   Úintr   r   r4   Ú__classcell__)r   s   @r   r
   r
      sx  ø€ € € € € à€Jð7ð 7ð 7ð 7ð 7ð ð ØØØØØ#'Ø05Ø6:Ø!%ØØ)-Ø-1Ø-1Ø*/Ø+0Ø',Ø#ØØ26ð)Zð 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ð Zñ „^ðZð Zð Zð Zð Zr   r
   N)Ú__doc__Ú
file_utilsr   Úprocessing_utilsr   Útokenization_utils_baser   r   r   Úutilsr   r
   Ú__all__r*   r   r   ú<module>rA      s²   ððð ð %Ð $Ð $Ð $Ð $Ð $Ø .Ð .Ð .Ð .Ð .Ð .Ø YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YØ #Ð #Ð #Ð #Ð #Ð #ð ðað að að að a˜ñ aô añ „ðaðH Ð
€€€r   