Ë
    _›¾jV  ã                   ó@  — d dl mZmZmZmZ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 ddlmZ erddlmZ g d¢Zd	ee   d
ee   fd„Zddded
eeee   f   fd„Zedœdddee   d
eeeeeee   ef   f   f   fd„Zedœdeeeeeee   ef   f   f   dee   d
dfd„Zy)é    )ÚTYPE_CHECKINGÚDictÚ	ItemsViewÚIterableÚListÚSetÚUnion)Úmsgé   )ÚErrors)ÚDocÚSpanÚToken)Údot_to_dict)ÚLanguage)ÚrequiresÚassignsÚscoresÚretokenizesÚvaluesÚreturnc           
      ó¼  ‡— t        t        j                  | d«      «      }t        t        t
        dœ}|j                  «       D �]‹  \  Š}‰dk(  r|| D �cg c]  }|j                  d«      sŒ|‘Œ }}|D �cg c]  }|j                  d«      rŒ|‘Œ }}|r8t        t        j                  j                  dj                  |«      ¬«      «      ‚‰|vrDdj                  ˆfd„| D «       «      }t        t        j                  j                  ‰|¬	«      «      ‚t        |t        «      s)t        t        j                  j                  ‰¬
«      «      ‚|j                  «       D �]o  \  }}|dk(  r |du r8t        t        j                  j                  dj                  ‰«      ¬
«      «      ‚|j                  «       D ]P  \  }}	|	dusŒ‰› d|› �}
|
› ddj                  |	«      › �}t        t        j                   j                  ||
¬«      «      ‚ Œ¬|j#                  d«      r-t        t        j$                  j                  ||dd ¬«      «      ‚|durG‰› d|› �}
|
› ddj                  |«      › �}t        t        j                   j                  ||
¬«      «      ‚|‰   }t'        ||«      r�ŒHt        t        j(                  j                  ‰|¬«      «      ‚ �ŒŽ | S c c}w c c}w )a£  Validate component attributes provided to "assigns", "requires" etc.
    Raises error for invalid attributes and formatting. Doesn't check if
    custom extension attributes are registered, since this is something the
    user might want to do themselves later in the component.

    values (Iterable[str]): The string attributes to check, e.g. `["token.pos"]`.
    RETURNS (Iterable[str]): The checked attributes.
    T)ÚdocÚtokenÚspanr   zspan.zspan._.ú, )Úattrsc              3   óF   •K  — | ]  }|j                  ‰«      sŒ|–— Œ y ­w©N)Ú
startswith)Ú.0ÚaÚobj_keys     €ú]/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/spacy/pipe_analysis.pyú	<genexpr>z!validate_attrs.<locals>.<genexpr>$   s   øè ø€ Ò%Q¨A¸1¿<¹<ÈÕ;P¤aÑ%Qùs   ƒ!š!)Úobjr   )ÚattrÚ_z{}._z._.ú.)r'   ÚsolutionNéÿÿÿÿ)r&   r'   )r   ÚdictÚfromkeysr   r   r   Úitemsr    Ú
ValueErrorr   ÚE180ÚformatÚjoinÚE181Ú
isinstanceÚE182ÚE183ÚendswithÚE184ÚhasattrÚE185)r   ÚdataÚobjsr   r'   Ú
span_attrsÚinvalid_attrsÚvalueÚext_attrÚ	ext_valueÚgoodÚbadr&   r#   s                @r$   Úvalidate_attrsrD      s•  ø€ ô ”t—}‘} V¨TÓ2Ó3€DÜ¤´Ñ5€DØŸ*™*›,ó M‰ˆ�Ø�fÒà+1ÖN 4°T·_±_ÀWÕ5Mš$ÐNˆJÐNØ+5ÖX 4¸T¿_¹_ÈYÕ=Wš$ÐXˆJÐXÙÜ ¤§¡×!3Ñ!3¸$¿)¹)ÀJÓ:OÐ!3Ó!PÓQÐQØ˜$ÑØ ŸI™IÓ%Q°Ô%QÓQˆMÜœVŸ[™[×/Ñ/°GÀ=Ð/ÓQÓRÐRÜ˜%¤Ô&ÜœVŸ[™[×/Ñ/°WÐ/Ó=Ó>Ð>Ø Ÿ;™;›=ó 	M‰KˆD�%Ø�sŠ{Ø˜D‘=Ü$¤V§[¡[×%7Ñ%7¸V¿]¹]È7Ó=SÐ%7Ó%TÓUÐUØ+0¯;©;«=ò VÑ'�H˜ià ¨Ò,Ø") ¨#¨h¨ZÐ8˜Ø!%  a¨¯©°Ó(;Ð'<Ð=˜Ü(¬¯©×);Ñ);ÀÈtÐ);Ó)TÓUÐUðVð Ø�}‰}˜SÔ!Ü ¤§¡×!3Ñ!3¸ÈÈSÈbÈ	Ð!3Ó!RÓSÐSØ˜DÑ Ø!˜ ! D 6Ð*�Ø˜˜a §¡¨£Ð0Ð1�Ü ¤§¡×!3Ñ!3¸ÀtÐ!3Ó!LÓMÐMØ�w‘-ˆCÜ˜3 Ö%Ü ¤§¡×!3Ñ!3¸ÀdÐ!3Ó!KÓLÐLò'	MðMð@ €Mùò; OùÚXs   ÁKÁ*KÁ4KÂKÚnlpr   r'   c                 óÞ   — g g dœ}| j                   D ]X  }| j                  |«      }||j                  v r|d   j                  |«       ||j                  v sŒE|d   j                  |«       ŒZ |S )a%  Check which components in the pipeline assign or require an attribute.

    nlp (Language): The current nlp object.
    attr (str): The attribute, e.g. "doc.tensor".
    RETURNS (Dict[str, List[str]]): A dict keyed by "assigns" and "requires",
        mapped to a list of component names.
    )r   r   r   r   )Ú
pipe_namesÚget_pipe_metar   Úappendr   )rE   r'   ÚresultÚ	pipe_nameÚmetas        r$   Úget_attr_inforM   ?   sv   € ð 02¸rÑ#B€FØ—^‘^ò 1ˆ	Ø× Ñ  Ó+ˆØ�4—<‘<ÑØ�9Ñ×$Ñ$ YÔ/Ø�4—=‘=Ò Ø�:Ñ×%Ñ% iÕ0ð1ð €Mó    )ÚkeysrO   c          
      ó¨  — i i dœ}t        «       }t        | j                  «      D ]ü  \  }}| j                  |«      }|j	                  |j
                  «       |j	                  |j                  «       |D �ci c]  }|t        ||d«      “Œ c}|d   |<   | j                  d| }t        j                  |j                  d«      }	|	r1|D ],  \  }
}| j                  |
«      }|j
                  D ]  }d|	|<   Œ	 Œ. |	j                  «       D ��cg c]
  \  }}|rŒ	|‘Œ c}}|d   |<   Œþ |D �ci c]  }|t        | |«      “Œ c}|d<   |S c c}w c c}}w c c}w )aX  Print a formatted summary for the current nlp object's pipeline. Shows
    a table with the pipeline components and why they assign and require, as
    well as any problems if available.

    nlp (Language): The nlp object.
    keys (List[str]): The meta keys to show in the table.
    RETURNS (dict): A dict with "summary" and "problems".
    )ÚsummaryÚproblemsNrQ   FTrR   r   )ÚsetÚ	enumeraterG   rH   Úupdater   r   ÚgetattrÚpipeliner,   r-   r.   rM   )rE   rO   rJ   Ú	all_attrsÚiÚnamerL   ÚkeyÚ
prev_pipesr   Ú	prev_nameÚ	prev_pipeÚ	prev_metaÚannotÚ	fulfilledr'   s                   r$   Úanalyze_pipesrb   Q   sc  € ð Øñ<€Fô ›%€IÜ˜SŸ^™^Ó,ò 
‰ˆˆ4Ø× Ñ  Ó&ˆØ×Ñ˜Ÿ™Ô&Ø×Ñ˜Ÿ™Ô'ØLPÖ"QÀS 3¬°°c¸4Ó(@Ñ#@Ò"QˆˆyÑ˜$ÑØ—\‘\ " 1Ð%ˆ
Ü—=‘= §¡°Ó6ˆÙØ(2ò +Ñ$�	˜9Ø×-Ñ-¨iÓ8�	Ø&×.Ñ.ò +�EØ&*�H˜U’Oñ+ð+ð
 +3¯.©.Ó*:÷$
Ù&�e˜YÂ)ŠEó$
ˆˆzÑ˜4Ò ð
ð CLÖL¸$�tœ]¨3°Ó5Ñ5ÒL€Fˆ7�OØ€Mùò #Rùó$
ùò Ms   Á6EÄ	
E	ÄE	Ä(EÚanalysisNc                óð  — t        j                  d«       ddg|D �cg c]  }|j                  «       ‘Œ c}¢}| d   j                  «       }t	        |«      D ����cg c]*  \  }\  }}||g|j                  «       D �cg c]  }|‘Œ c}¢‘Œ, }	}}}}t        j                  |	|dd¬«       t        d„ | d   j                  «       D «       «      }
t        d	„ | d   j                  «       D «       «      rbt        j                  d
|
› d�«       | d   j                  «       D ]2  \  }}|sŒ	t        j                  d|› ddj                  |«      › �«       Œ4 yt        j                  d«       yc c}w c c}w c c}}}}w )zÙPrint a formatted version of the pipe analysis produced by analyze_pipes.

    analysis (Dict[str, Union[List[str], Dict[str, List[str]]]]): The analysis.
    keys (List[str]): The meta keys to show in the table.
    zPipeline Overviewú#Ú	ComponentrQ   T)ÚheaderÚdividerÚ	multilinec              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )Úlen©r!   Úps     r$   r%   z&print_pipe_analysis.<locals>.<genexpr>ƒ   s   è ø€ ÒC ”S˜—VÑCùs   ‚rR   c              3   ó    K  — | ]  }|–— Œ y ­wr   © rl   s     r$   r%   z&print_pipe_analysis.<locals>.<genexpr>„   s   è ø€ Ò
4�Œ1Ñ
4ùs   ‚z
Problems (ú)ú'z' requirements not met: r   zNo problems found.N)r
   rh   Ú
capitalizer.   rT   r   ÚtableÚsumÚanyÚwarnr2   rB   )rc   rO   r[   rg   rQ   rY   ÚnÚmÚvÚbodyÚ
n_problemsrZ   Úproblems                r$   Úprint_pipe_analysisr}   t   sI  € ô ‡K�KÐ#Ô$Ø�;ÐD¸dÖ!C°s #§.¡.Õ"2Ò!CÐD€FØ! )Ñ,×2Ñ2Ó4€GÜ>GÈÓ>P×QÑQ±°±F°Q¸ˆQ�Ð, §¡£
Ö+˜1’QÒ+Ò,ÐQ€DÓQÜ‡I�Iˆd˜6¨4¸4Õ@ÜÑC X¨jÑ%9×%@Ñ%@Ó%BÔCÓC€JÜ
Ñ
4�h˜zÑ*×1Ñ1Ó3Ô
4Ô4Ü�‰�j  ¨AÐ.Ô/Ø% jÑ1×7Ñ7Ó9ò 	Q‰MˆD�'ÚÜ—‘˜1˜T˜FÐ":¸4¿9¹9ÀWÓ;MÐ:NÐOÕPñ	Qô 	�‰Ð%Õ&ùò "Dùâ+ùÕQs   �E&Á E0
Á;	E+ÂE0
Å+E0
)Útypingr   r   r   r   r   r   r	   Úwasabir
   Úerrorsr   Útokensr   r   r   Úutilr   Úlanguager   ÚDEFAULT_KEYSÚstrrD   rM   rb   r}   ro   rN   r$   ú<module>r†      s  ðß M× MÑ Må å ß $Ñ $Ý áå"ò @€ð+˜8 C™=ð +¨X°c©]ó +ð\�zð ¨ð °°c¸4À¹9°nÑ1Eó ð& +7ò Ø	ð Ø" 3™ið à	ˆ#ˆt�C˜˜t C™y¨$˜Ñ/Ð/Ñ0Ð
0Ñ1ó ðL #ò'Ø�3˜˜S %¨¨S©	°4¨Ñ"8Ð8Ñ9Ð9Ñ:ð'ð ˆs‰)ð'ð 
ô	'rN   