Files
INTUIA/Programa final/spacy/cli/__pycache__/apply.cpython-312.pyc
T

60 lines
6.7 KiB
Plaintext
Raw Normal View History

2026-03-15 13:27:50 +00:00
Ë
=û g”ãóZddlmZddlmZddlmZmZmZmZm Z ddl
Z
ddl Z ddl m
Z
ddlmZmZddlmZmZdd lmZd
d lmZmZmZmZmZmZd Zd
ZdZdZ dZ!eee"eefZ#dededeefdZ$dede"dee"fdZ%deedee"fdZ&ejNd«edd¬«eded¬«eded¬ «edd!d"e¬«ed#d$d%d&¬«edd'd(d)¬«ed*d+d,d-¬«ed
d.d/d0¬«ed
d1d2d3¬«f d4e"d5ed6ed7eed8e"d9e(d:e)d;e)d<e)fd=„«Z*d5ed6ed4e"d>e"d;e)d<e)f d?„Z+y)@é)Úchain)ÚPath)ÚIterableÚListÚOptionalÚUnionÚcastN)Úmsgé)ÚDocÚDocBin)Ú ensure_pathÚ
load_model)ÚVocabé)ÚArgÚOptÚappÚ import_codeÚ setup_gpuÚwalk_directorya•Location of the documents to predict on.
Can be a single file in .spacy format or a .jsonl file.
Files with other extensions are treated as single plain text documents.
If a directory is provided it is traversed recursively to grab
all files to be processed.
The files can be a mixture of .spacy, .jsonl and text files.
If .jsonl is provided the specified field is going
to be grabbed ("text" by default).z&Path to save the resulting .spacy filezNPath to Python file with additional code (registered functions) to be importedz3Use gold preprocessing provided in the .spacy fileszjThe provided output file already exists. To force overwriting the output file, set the --force or -F flag.ÚpathÚvocabÚreturnc#órKt«j|«}|j|«D]}|Œy­w)z)
Stream Doc objects from DocBin.
N)r
Ú from_diskÚget_docs)rrÚdocbinÚdocs úPC:\Users\garci\AppData\Roaming\Python\Python312\site-packages\spacy/cli/apply.pyÚ_stream_docbinr!%s2èø€ô‹X×
Ñ
 Ó
%€FؘuÖ%ˆØ ñ&ùs57Úfieldc#ó’Ktj|«D]+}||vrtj|d|dd¬«Œ%||Œ-y­w)z_
Stream "text" field from JSONL. If the field "text" is
not found it raises error.
z does not contain the required 'z' field.r©ÚexitsN)ÚsrslyÚ
read_jsonlr
Úfail)rr"Úentrys r Ú
_stream_jsonlr*.sLèø€ô
×! $ÖØ ˜Ñ Ü H‰H˜=¸e¸WÀHÐMÐUVÖ ˜‘,Ó ñ (ùsAAÚpathsc#ó„K|D]+}t|d«5}|j«}|ddd«Œ-y#1swYŒ8xYw­w)z2
Yields strings from text files in paths.
ÚrN)ÚopenÚread)r+rÚfinÚtexts r Ú
_stream_textsr2:s9èø€óˆÜ
Œ_ Ø—8‘8“:ˆDØŠJ÷ˆ_ñß
ˆ_üsA4© A´= ¹AÚapply.zModel name or path)ÚhelpT)r4ÚexistsF)r4Údir_okayz--codez-cr1z
--text-keyz-tkz$Key containing text string for JSONLz--forcez-Fz!Force overwriting the output fileéÿÿÿÿz--gpu-idz-gzGPU ID or -1 for CPU.z --batch-sizez-bz Batch size.z --n-processz-nznumber of processors to use.ÚmodelÚ data_pathÚ output_fileÚ code_pathÚtext_keyÚforce_overwriteÚuse_gpuÚ
batch_sizeÚ n_processc ó@t|«}t|«}t|«}|j«r|stjtd¬«|j«stjd|d¬«t |«t
|«t||||||«y)
Apply a trained pipeline to documents to get predictions.
Expects a loadable spaCy pipeline and path to the data, which
can be a directory or a file.
The data files can be provided in multiple formats:
1. .spacy files
2. .jsonl files with a specified "field" to read the text from.
3. Files with any other extension are assumed to be containing
a single document.
DOCS: https://spacy.io/api/cli#apply
rr$zCouldn't find data path: N)rr5r
r(Ú force_msgrrr3) r8r9r:r;r<r=r>r?r@s r Ú apply_clirCDsô0˜&€Iܘ*€Kܘ&€IØ×ÑÔ¡OÜ  !Õ × Ñ Ô Ü Ð,¨Y¨KÐÕ ÔÜ
ˆgÔÜ ˆ)[ %¨°:¸yÕÚ
json_fieldcóBtd¬«}t|«}t|«dk(r+|j|«t j
d|d«yt
|«}t jd|«|j} g}
g} |D]i} | jdk(r|
jt| | ««Œ.| jdk(r|
jt| |««ŒY| j| «Œkt| «dkDr|
jt| ««ttt!|
Ž«}
t#j"|j%|