Ë
    `›¾jÍ  ã                   óÌ  — d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm	Z	m
Z
 d dlZd dlZd dlZd dl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  ej6                  d
«       ej6                  d
d¬«       edd¬«       edddd¬«       edddd¬«      fdej8                  dedee   defd„«       «       Zd#dedee   deddfd„Z dede	e   ddfd„Z!d e
eef   d!edee   fd"„Z"y)$é    N)ÚPath)ÚIteratorÚOptionalÚSequenceÚUnion)ÚPrinterÚmsgé   )ÚLanguage)Ú
load_modelé   )ÚNAMEÚArgÚOptÚappÚ	debug_cliÚprofileT)Úhidden.zTrained pipeline to load)Úhelpz&Location of input file. '-' for stdin.)r   ÚexistsÚ
allow_dashé'  z	--n-textsz-nz+Maximum number of texts to use if availableÚctxÚmodelÚinputsÚn_textsc                 ó˜   — | j                   j                  j                  t        k(  rt	        j
                  d«       t        |||¬«       y)a\  
    Profile which functions take the most time in a spaCy pipeline.
    Input should be formatted as one JSON object per line with a key "text".
    It can either be provided as a JSONL file, or be read from sys.sytdin.
    If no input file is specified, the IMDB dataset is loaded via Thinc.

    DOCS: https://spacy.io/api/cli#debug-profile
    z¬The profile command is now available via the 'debug profile' subcommand. You can run python -m spacy debug --help for an overview of the other available debugging commands.)r   r   N)ÚparentÚcommandÚnamer   r	   Úwarnr   )r   r   r   r   s       ú[/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/spacy/cli/profile.pyÚprofile_clir#      s<   € ð2 ‡z�z×Ñ×Ñ¤$Ò&Ü�‰ðBô	
ô
 ˆE˜&¨'Ö2ó    Úreturnc                 óL  — |�/t        |t        «      }t        t        j                  ||«      «      }|€f	 dd l}t        j                  d«      5  j                  |d¬«      \  }}|D ��cg c]  \  }}|‘Œ	 }}}d d d «       t        j                  d|› d�«       t        j                  d	| › d
�«      5  t        | «      }d d d «       t        j                  d| › d�«       t        j                  dt        «       t!        «       d«       t#        j$                  d«      }	t        j&                  d«       |	j)                  «       j+                  d«      j-                  «        y # t        $ r t        j                  dd¬«       Y �ŒJw xY wc c}}w # 1 sw Y   �ŒxY w# 1 sw Y   ŒÜxY w)Nr   zwThis command, when run without an input file, requires the ml_datasets library to be installed: pip install ml_datasetsr   ©Úexitsz'Loading IMDB dataset via ml_datasets...)Útrain_limitÚ	dev_limitzLoaded IMDB dataset and using z	 exampleszLoading pipeline 'z'...zLoaded pipeline 'ú'zparse_texts(nlp, texts)zProfile.profzProfile statsÚtime)Ú_read_inputsr	   ÚlistÚ	itertoolsÚisliceÚml_datasetsÚImportErrorÚfailÚloadingÚimdbÚinfor   ÚgoodÚcProfileÚrunctxÚglobalsÚlocalsÚpstatsÚStatsÚdividerÚ
strip_dirsÚ
sort_statsÚprint_stats)
r   r   r   Útextsr1   Ú
imdb_trainÚ_ÚtextÚnlpÚss
             r"   r   r   4   sm  € ØÐÜ˜V¤SÓ)ˆÜ”Y×%Ñ% e¨WÓ5Ó6ˆØ€~ð	Ûô �[‰[ÐBÓCñ 	5Ø'×,Ñ,¸ÈAÐ,ÓN‰MˆJ˜Ø)3×4™g˜d A’TÐ4ˆEÑ4÷	5ô 	�‰Ð1°'°¸)ÐDÔEÜ	�‰Ð)¨%¨°Ð5Ó	6ñ  Ü˜Óˆ÷ ä‡H�HÐ    qÐ)Ô*Ü‡O�OÐ-¬w«y¼&»(ÀNÔSÜ�‰�^Ó$€AÜ‡K�K�Ô Ø‡L�LƒN×Ñ˜fÓ%×1Ñ1Õ3øô% ò 	Ü�H‰Hð*ð ÷	ð ð	üó 5÷	5ñ 	5ú÷ ð  ús;   µE  ÁFÁ*FÁ6FÂ3FÅ  FÆFÆFÆFÆF#rF   rB   c                 ó^   — | j                  t        j                  |d ¬«      d¬«      D ]  }Œ y )N)Údisableé   )Ú
batch_size)ÚpipeÚtqdm)rF   rB   Údocs      r"   Úparse_textsrO   P   s,   € Ø�x‰xœŸ	™	 %°Ô6À2ˆxÓFò ˆØñr$   Úlocr	   c              #   óœ  K  — | dk(  r, |j                   d«       t        j                  }d„ |D «       }nrt        | «      }|j	                  «       r|j                  «       s |j                  d| d¬«        |j                   d|j                  d   › �«       |j                  «       }|D ]   }t        j                  |«      }|d	   }|–— Œ" y ­w)
Nú-zReading input from sys.stdinc              3   ó>   K  — | ]  }|j                  d «      –— Œ y­w)Úutf8N)Úencode)Ú.0Úlines     r"   ú	<genexpr>z_read_inputs.<locals>.<genexpr>Y   s   è ø€ Ò7¨�—‘˜V×$Ñ7ùs   ‚zNot a valid input data filer   r'   zUsing data from éÿÿÿÿrE   )r6   ÚsysÚstdinr   r   Úis_filer3   ÚpartsÚopenÚsrslyÚ
json_loads)rP   r	   Úfile_Ú
input_pathrW   ÚdatarE   s          r"   r-   r-   U   s½   è ø€ Ø
ˆc‚zØˆ�‰Ð/Ô0Ü—	‘	ˆÙ7°Ô7‰ä˜#“Yˆ
Ø× Ñ Ô"¨*×*<Ñ*<Ô*>ØˆC�H‰HÐ2°C¸qÕAØˆ�‰Ð# J×$4Ñ$4°RÑ$8Ð#9Ð:Ô;Ø—‘Ó!ˆØò ˆÜ×Ñ Ó%ˆØ�F‰|ˆØ‹
ñùs   ‚C
C)Nr   )#r8   r/   r<   rZ   Úpathlibr   Útypingr   r   r   r   r_   rM   ÚtyperÚwasabir   r	   Úlanguager   Úutilr   Ú_utilr   r   r   r   r   r   ÚContextÚstrÚintr#   r   rO   r-   © r$   r"   ú<module>ro      s7  ðÛ Û Û Û 
Ý ß 6Ó 6ã Û Û ß å Ý ß 1Õ 1ð €×Ñ�9ÓØ€‡�ˆY˜tÔ$ñ �SÐ9Ô:Ù ØØ5ØØô	ñ Øˆ{˜DÐ'Tôñ3à	�‰ð3ð ð3ð �T‰Nð	3ð ò3ó %ó ð3ñ@4�3ð 4 ¨¡ð 4Àð 4ÐPTó 4ð8�Xð  h¨s¡mð ¸ó ð
�e˜D #˜IÑ&ð ¨Wð ¸À#¹ô r$   