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

581 lines
53 KiB
Plaintext
Raw Normal View History

2026-03-15 13:27:50 +00:00
Ë
=û gW·ãó8ddlmZddlmZmZmZmZmZmZm Z m
Z
m Z ddl Z
ddlmZddlmZddlmZmZmZddlmZdd lmZmZerdd
lmZd Zegd ¢«ZGd
d«Z Gdd«Z!Gdd«Z"deedee#effdZ$ddZ%dZ&dZ'dZ(ddZ)dZ*y)é)Ú defaultdict) Ú
TYPE_CHECKINGÚAnyÚCallableÚDictÚIterableÚListÚOptionalÚSetÚTupleNé)ÚErrors)Ú
Morphology)ÚDocÚSpanÚToken)ÚExample)ÚSimpleFrozenListÚget_lang_class)ÚLanguage)ÚsenterÚtaggerÚ
morphologizerÚparserÚnerÚtextcat)NrÚc ó¶eZdZdZddddœdedededdfd „Zdefd
Zd Zd Zd
e de ddfdZ
e de fd«Z
e de fd«Ze de fd«Zdeee ffdZy)ÚPRFScorezA precision / recall / F score.r©ÚtpÚfpÚfnr!r"r#ÚreturnNcó.||_||_||_y©Nr )Úselfr!r"r#s úMC:\Users\garci\AppData\Roaming\Python\Python312\site-packages\spacy/scorer.pyÚ__init__zPRFScore.__init__"sðˆŒØˆŒØˆócóN|j|jz|jzSr&r ©r's r(Ú__len__zPRFScore.__len__-sØw‰w˜ŸÑ  4§7¡7Ñ*r*cóÀ|xj|jz
c_|xj|jz
c_|xj|jz
c_|Sr&r ©r'Úothers r(Ú__iadd__zPRFScore.__iadd__0s=Ø Š5—8‘8ÑØ Š5—8‘8ÑØ Š5—8‘8ÑØˆ r*có¨t|j|jz|j|jz|j|jz¬«S)Nr )rr!r"r#r/s r(Ú__add__zPRFScore.__add__6s=ÜØw‰w˜ŸÑ! d§g¡g°·±Ñ&8¸T¿W¹WÀuÇxÁxÑ=Oô
ð
r*ÚcandÚgoldcóâ|xjt|j|««z
c_|xjt||z
«z
c_|xjt||z
«z
c_yr&)r!ÚlenÚ intersectionr"r#©r'r4r5s r(Ú score_setzPRFScore.score_set;sNØ Š”3Ó/Ø Š”3t˜d‘{Ó#Ø Š”3t˜dr*cóT|j|j|jzdzz S©Nç0Žä.ÿ++)r!r"r,s r(Ú precisionzPRFScore.precision@ó#àw‰w˜$Ÿ'™' D§G¡GÑ+¨fÑ5r*cóT|j|j|jzdzz Sr<)r!r#r,s r(ÚrecallzPRFScore.recallDr?r*cóT|j}|j}d||z||zdzz zS)r=)r>rA)r'Úrs r(ÚfscorezPRFScore.fscoreHs0à N‰NˆØ K‰KˆØ‘U˜q 1™u v™~Ñ/r*cóJ|j|j|jdœS)N)rDrEÚf)r>rArFr,s r(Úto_dictzPRFScore.to_dictNsØ—^^¨$¯+©+¸D¿K¹KÑHr*)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Úintr)r-r1r3Úsetr:ÚpropertyÚfloatr>rArFrÚstrrI©r*r(rrÙ
ØØò ð
ð ð
ð ð
ð ð
ó
ðóò 
ð
$˜cððó
ð6˜5òððòððòð
I˜˜c 5˜Ir*rcó6eZdZdZddZddZdZed«Zy)Ú ROCAUCScorez¡An AUC ROC score. This is only defined for binary classification.
Use the method is_binary before calculating the score, otherwise it
may throw an error.Ncó<g|_g|_d|_d|_y)r)ÚgoldsÚcandsÚ saved_scoreÚsaved_score_at_lenr,s r(r)zROCAUCScore.__init__Ws Ø "ˆŒ
Ø "ˆŒ
ØˆÔØ"#ˆÕr*cóp|jj|«|jj|«yr&)rYÚappendrXr9s r(r:zROCAUCScore.score_set]s&Ø
×јØ
×ј$Õr*cóXttj|j««dk(S©NrC)r7ÚnpÚuniquerXr,s r(Ú is_binaryzROCAUCScore.is_binaryasÜ”2—99˜TŸZ™ZÓ)¨QÑ.r*cóŒ|j«s<ttjj t |j «¬««t|j «|jk(r |jSt|j |j«|_ t|j «|_|jS)Úlabel) rbÚ
ValueErrorrÚE165ÚformatrOrXr7r[rZÚ_roc_auc_scorerYr,s r(ÚscorezROCAUCScore.scoreds†à~‰~ÔÜœVŸ[™[×/´c¸$¿*¹*³oÐ ˆtz‰z‹?˜d× × )¨$¯*©*°d·j±jÓAˆÔÜ"% d§j¡j£/ˆÔØ×ÑÐr*)r$N) rJrKrLrMr)r:rbrPrjrSr*r(rUrURs*ñó  òñ óñ r*rUcóÔeZdZdZddefdeddedeeddfd „Zd
d œd ee d
e
de ee ffdZ
ed ee de ee ffd«Zeeedœd ee dedeeege fdee de ee ff
d«Zeeedœd ee dedeeege fdee de ee ff
d«Zeeddd
dœd ee dedeeegeefdeeege
fde
de
de ee ffd«Zeee«ddddœd ee dedeeege fdeede
deed eede ee ffd!„«Zed ee d"eede ee ffd#„«Zeed$ee«ed%œd ee dedeeege fd&ed'eeegefd(eedee de ee ffd)„«Zy)*ÚScorerzCompute evaluation scores.NÚxxÚnlprÚ default_langÚdefault_pipeliner$c ó„||_|r||_yt|««}|D]}|j|«Œ||_y)zOInitialize the Scorer.
DOCS: https://spacy.io/api/scorer#init
N)ÚcfgrnrÚadd_pipe)r'rnrorprrÚpipes r(r)zScorer.__init__rsAðˆŒÙ ؈D.”. Ó0ˆCÛ(Ø ˜TÕˆDHr*F)Ú
per_componentÚexamplesrucó,i}t|jjd«rw|r5|jjj|fi|j¤Ž|d<n@|j |jjj|fi|j¤Ž«|jj D]a\}}t|d«sŒ|r!|j|fi|j¤Ž||<Œ6|j |j|fi|j¤Ž«Œc|S)aQEvaluate a list of Examples.
examples (Iterable[Example]): The predicted annotations + correct annotations.
per_component (bool): Whether to return the scores keyed by component
name. Defaults to False.
RETURNS (Dict): A dictionary of scores.
DOCS: https://spacy.io/api/scorer#score
rjÚ tokenizer)ÚhasattrrnrxrjrrÚupdateÚpipeline)r'rvruÚscoresÚnameÚ components r(rjz Scorer.score†ðˆÜ 4—8‘8×%  Ø&> d§h¡h×&8Ñ&8×&>Ñ&>¸xÑ&TÈ4Ï8É8Ñ&T
Ð6˜dŸh™h×6°xÑLÀ4Ç8Á8Ñ#Ÿx™x×0‰OˆDy  Ø#2 9§?¡?°8Ñ#H¸t¿x¹xÑ#HF˜4—MM / )§/¡/°(Ñ"G¸d¿h¹hÑ"GÕ ˆ
r*c óht«}t«}|D]U}|j}|j}|jrŒ)|j}t «}t «} |D]P}
|
j j«rŒ|j|
j|
jt|
«zf«ŒR|D}
|
j j«rŒ| j|
j|
jt|
«zf«|jj|
jdk7r|xjdz
c_Œ|xjdz
c_Œ£|j!| |«ŒXt|«dkDr/|j"|j"|j$|j&dœSdddddœS)a~Returns accuracy and PRF scores for tokenization.
* token_acc: # correct tokens / # gold tokens
* token_p/r/f: PRF for token character spans
examples (Iterable[Example]): Examples to score
RETURNS (Dict[str, Any]): A dictionary containing the scores
token_acc/p/r/f.
DOCS: https://spacy.io/api/scorer#score_tokenization
r
r)Ú token_accÚtoken_pÚtoken_rÚtoken_fN)rÚ referenceÚ predictedÚhas_unknown_spacesÚ alignmentrOÚorth_ÚisspaceÚaddÚidxr7Úx2yÚlengthsÚir"r!r:r>rArF) rvrrÚ acc_scoreÚ prf_scoreÚexampleÚgold_docÚpred_docÚalignÚ
gold_spansÚ
pred_spansÚtokens r(Úscore_tokenizationzScorer.score_tokenization stô“Jˆ Ü“Jˆ ܈GØ×(ˆHØ×(ˆHØ×Ø×%ˆE܈J܈JÛ!Ø—;;ר § ¡ ¨5¯9©9´s¸5³zÑ+AÐ"Ø—;;ר § ¡ ¨5¯9©9´s¸5³zÑ+AЗ9‘9×$ U§W¡WÑÒ—L’L AÑ%–Là—LL %
× Ñ  
¨JÖ 7ð) ô* ˆy>˜ à&×$×$×$×ð
ðØØñ ð
r*)ÚgetterÚmissing_valuesÚattrr™c óºt«}|D]'}|j}|j}|j} t «}
t «} t |«D]>\} }
||
|«}||vr|
j
| ||
|«f«Œ.| j
| «Œ@t «}|D]}
|
jj«rŒ| jj|
jdk(sŒE| j|
jd} | | vsŒf|j
| ||
|«f«Œ|j||
«Œ*|d}t|«dk(r|diS||jiS)aReturns an accuracy score for a token-level attribute.
examples (Iterable[Example]): Examples to score
attr (str): The attribute to score.
getter (Callable[[Token, str], Any]): Defaults to getattr. If provided,
getter(token, attr) should return the value of the attribute for an
individual token.
missing_values (Set[Any]): Attribute values to treat as missing annotation
in the reference annotation.
RETURNS (Dict[str, Any]): A dictionary containing the accuracy score
under the key attr_acc.
DOCS: https://spacy.io/api/scorer#score_token_attr
r
rÚ_accN)rr„r…r‡rOÚ enumeraterŠrˆr‰rr:r7rF)rvrr™rrÚ tag_scorerrr“r”Ú gold_tagsÚmissing_indicesÚgold_ir—ÚvalueÚ pred_tagsÚ score_keys r(Úscore_token_attrzScorer.score_token_attrÒsPô.“Jˆ ܈GØ×(ˆHØ×(ˆHØ×%ˆE܈IÜ!›eˆOÜ!*¨8Ö!4
˜Ù˜u dÓ+Ø Ñ—MM 6©6°%¸Ó+>Ð"?Õ#×Õ "5ô ˆ!Ø—;;ר—99×$ U§W¡WÑÓ"ŸY™Y u§w¡wÑÑ2 
 v©v°e¸TÓ/BÐ&CÕ

× Ñ   ¨9Ö 5ð) ð*f˜DMˆ Ü ˆy>˜QÒ Ø˜tÐ ˜y× 0r*c
óþt«}i}|D}|j}|j} |j}
i} t «} t | «D\}
}|||«}| j j|}||vr|tjk7r|jtj«D]\}|jtj«\}}||vr
t«||<|| vr
t «| |<| |j|
|f«Œ^Œ¾| j|
«ŒÐi}|D]}|jj«rŒ|
j j"|j$dk(sŒF|
j |j$d}
|
| vsŒg|||«}| j j|}||vsŒŽ|tjk7sŒ¢|jtj«D]\}|jtj«\}}||vr
t«||<||vr
t «||<||j|
|f«Œ^Œ"|D]‰}|j'|j)|t ««| j)|t «««||j'|j)|t ««| j)|t «««Œ‹ŒÇi}t+|«dkDrp|j,||d<|j.||d<|j0||d<|j3«Dcic]\}}||j5«Œc}}||d<|Sd||d<d||d<d||d<d||d<|Scc}}w)a­Return micro PRF and PRF scores per feat for a token attribute in
UFEATS format.
examples (Iterable[Example]): Examples to score
attr (str): The attribute to score.
getter (Callable[[Token, str], Any]): Defaults to getattr. If provided,
getter(token, attr) should return the value of the attribute for an
individual token.
missing_values (Set[Any]): Attribute values to treat as missing
annotation in the reference annotation.
RETURNS (dict): A dictionary containing the micro PRF scores under the
key attr_micro_p/r/f and the per-feat PRF scores under
attr_per_feat.
r
rÚ_micro_pÚ_micro_rÚ_micro_fÚ _per_featN)rr…r„r‡rOÚvocabÚstringsrÚ EMPTY_MORPHÚsplitÚ FEATURE_SEPÚ FIELD_SEPrŠrˆr‰rr:Úgetr7r>rArFÚitemsrI)rvrr™rrÚ micro_scoreÚper_featrr“rr”Ú
gold_per_featr¡r—ÚmorphÚfeatÚfieldÚvaluesÚ
pred_per_featÚresultÚvs r(Úscore_token_attr_per_featz Scorer.score_token_attr_per_featsqô.“jˆ ؈܈GØ×(ˆHØ×(ˆHØ×%ˆEØ,.ˆ!eˆOÜ!*¨8Ö!4
˜Ù˜u dÓ+Ø Ÿ×.¨uÑ5Ø Ñ.°5¼J×<RÑ<RÒ3RØ %§ ¡ ¬J×,BÑ,BÖ C˜Ø(,¯
©
´:×3GÑ3GÓ(H™
˜˜vØ ¨Ñ0Ü.6«j˜H U™OØ ¨
Ñ5Ü36³5˜M¨%Ñ% ,×0°&¸Õ
!Dð$×Õ"5ð-/ˆ!Ø—;;ר—99×$ U§W¡WÑÓ"ŸY™Y u§w¡wÑÑ2 4Ù & u¨dÓ 3˜Ø (§¡× 6Ñ 6°uÑ =˜àÒ7Ø %¬×)?Ñ)?Ó ?à(-¯ © ´J×4JÑ4JÖ(K Ø04·
±
¼:×;OÑ;OÓ0P¡
  vØ#(°Ñ#8Ü6>³j H¨U¡OØ#(°
Ñ#=Ü;>»5 M°%Ñ$8Ø -¨eÑ 4× 8Ñ 8¸&À$¸Õ Hò
)Lð"ó&"Ø×!×% e¬S«UÓ3°]×5FÑ5FÀuÌcËeÓ5Tôð˜×% e¬S«UÓ3°]×5FÑ5FÀuÌcËeÓ5Tõò "ðO ð\"$ˆÜ ˆ ˜ Ø(3×(=Ñ(=ˆFdV˜ %Ø(3×(:Ñ(:ˆFdV˜ %Ø(3×(:Ñ(:ˆFdV˜ %ØEMÇ^Á^ÔEUÔ)VÑEU¹T¸¨!¨Q¯Y©Y«[©.ÐEUÒ)VˆFdV˜ ˆ
ð )-ˆFdV˜ %Ø(,ˆFdV˜ %Ø(,ˆFdV˜ %Ø)-ˆFdV˜ ˆ
ùó
*WsÌ0M9T)r™Úhas_annotationÚlabeledÚ
allow_overlaprÀc ó:t«}t«}|D]M} | j}
| j} | || «sŒ't || |«D cgc]} | j
Œc} «}
|
|5||
«r-|
t ||
|«D cgc]} | j
Œc} «z}
|
Dcic]
}|t «Œ}}|
D]}||vsŒt«||<Œt «}t «}|| |«D]u}|r'|j
|j |jdz
f}n|j |jdz
f}|j|«||j
j|«Œw|
Dcic]
}|t «Œ}}|
|||
«r| j||
|«|«D]u}|r'|j
|j |jdz
f}n|j |jdz
f}|j|«||j
j|«Œw|r5|j«D]"\} }| |vsŒ |j|| || «Œ$|j||«ŒP|dd|dd|ddi}|rd||d<t|«dkDrp|j||d<|j||d<|j||d<|r8|j«D cic]\} }| |j!«Œc}} ||d<|Scc} wcc} wcc}wcc}wcc}} w)abReturns PRF scores for labeled spans.
examples (Iterable[Example]): Examples to score
attr (str): The attribute to score.
getter (Callable[[Doc, str], Iterable[Span]]): Defaults to getattr. If
provided, getter(doc, attr) should return the spans for the
individual doc.
has_annotation (Optional[Callable[[Doc], bool]]) should return whether a `Doc`
has annotation for this `attr`. Docs without annotation are skipped for
scoring purposes.
labeled (bool): Whether or not to include label information in
the evaluation. If set to 'False', two spans will be considered
equal if their start and end match, irrespective of their label.
allow_overlap (bool): Whether or not to allow overlapping spans.
If set to 'False', the alignment will automatically resolve conflicts.
RETURNS (Dict[str, Any]): A dictionary containing the PRF scores under
the keys attr_p/r/f and the per-type PRF scores under attr_per_type.
DOCS: https://spacy.io/api/scorer#score_spans
Nr
Ú_pÚ_rÚ_fÚ _per_typer)rÚdictr…r„rOÚlabel_ÚstartÚendrŠÚget_aligned_spans_x2yr³r:r7r>rArFrI)rvrr™rrrjÚscore_per_typerr“rÚlabelsreÚ
gold_per_typer•rÚspanÚ gold_spanÚ
pred_per_typeÚ pred_spanr¾Ú final_scoress r(Ú score_spanszScorer.score_spansYs<ô>
ˆÜˆÜˆGØ×(ˆHØ×(ˆHàÐ)±.ÀÔ2JØä©F°8¸TÔ,BÓCÑ,B q˜!Ÿ((Ð,BÑDˆÐÐ*©~¸hÔ/Gàœ#±¸À$Ô1GÓHÑ1G¨A˜qŸxxÐ1GÑIáGMÓ,NÁv¸e¨U´C³E©\ÀvˆMÐ,NÛØ Ò.Ü,4«JN 5Ò ôˆJ܈JÙ˜x¨Ö.áØ!%§¡¨d¯j©j¸$¿(¹(ÀQ¹,Ð G‘Ià!%§¡¨T¯X©X¸©\Ð :˜yÔ˜dŸk™kÑ.¨yÕHNÓ,NÁv¸e¨U´C³E©\ÀvˆMÐ,NØÐÐ*©~¸hÔ/Gà˜8 TÓ*¨MöØ%)§[¡[°$·*±*¸d¿h¹hȹlÐ$K™ à%)§Z¡Z°·±¸Ð$>˜ Ø—NN ! $§+¡+Ñ.×2°9ÕñØ2‘DA˜MÒŸ  M°!Ñ$4°mÀAÑ6FÕ
O‰O˜
Ö 3ðc ðhˆfBˆK˜ØˆfBˆK˜ØˆfBˆK˜ð(
ˆ ñ
Ø/3ˆL˜D˜6 Ð ˆu:˜Š>Ø(-¯©ˆL˜D˜6 ˜Ñ %Ø(-¯ © ˆL˜D˜6 ˜Ñ %Ø(-¯ © ˆL˜D˜6 ˜Ñ à/=×/CÑ/CÔ/Eô4Ù/E¡t q¨!Aq—yy“{NÐ/Eò4  ˜v YÐÐùòwDùò
Iùâ,Nùò-OùóD4sÁL
ÂL Â%L
Å+LËL)r™Ú multi_labelÚpositive_labelÚ thresholdrÎr×c ó"
||rdnd}|sd}|Dcic]
}|t«Œ} }|Dcic]
}|t«Œ}
}t|«}|D]^} || j|«} | j «D
cic]
\}
}|
|vsŒ |
|Œ} }
}|| j
|«}|j «D
cic]
\}
}|
|vsŒ |
|Œ}}
}|D]C}| j
|d«}|j
|«}|s|sd}|Œ/|
|j||«ŒE|r™|D]}| j
|d«}|j
|«}|Œ)||k\r|dkDr| |xjdz
c_ŒL||k\r|dk(r| |xjdz
c_ Œo||ksŒu|dkDsŒ{| |xjdz
c_
Œ”Œ]| r|rt| j «d¬«\}}t|j «d¬«\}}||k(r| |xjdz
c_Œ¾| |xjdz
c_
| |xjdz
c_ Œð|r2t|d „¬«\}}|dkDsŒ
| |xjdz
c_
Œ$| sŒ(t| j «d
¬«\}}| |xjdz
c_ Œat«}| j«D]_}|xj|jz
c_|xj|jz
c_
|xj|jz
c_ Œat| «d z}td | j«D««|z }td
| j«D««|z }td| j«D««|z }td|
j«D««|z }|dd|dd|d|j|d|j |d|j"|d||d||d||d||d| j «D
cic]\}
}|
|j%«Œc}}
|d|
j «D
cic]$\}
}|
|j'«r |j(ndŒ&c}}
i }t|«dk(r(|s&|r$||d|d}|||d<d|d||d<|S|s||d||d<d||d<|S||d||d<d ||d<|Scc}wcc}wcc}}
wcc}}
wcc}}
wcc}}
w)!a•Returns PRF and ROC AUC scores for a doc-level attribute with a
dict with scores for each label like Doc.cats. The reported overall
score depends on the scorer settings.
examples (Iterable[Example]): Examples to score
attr (str): The attribute to score.
getter (Callable[[Doc, str], Any]): Defaults to getattr. If provided,
getter(doc, attr) should return the values for the individual doc.
labels (Iterable[str]): The set of possible labels. Defaults to [].
multi_label (bool): Whether the attribute allows multiple labels.
Defaults to True. When set to False (exclusive labels), missing
gold labels are interpreted as 0.0 and the threshold is set to 0.0.
positive_label (str): The positive label for a binary task with
exclusive classes. Defaults to None.
threshold (float): Cutoff to consider a prediction "positive". Defaults
to 0.5 for multi-label, and 0.0 (i.e. whatever's highest scoring)
otherwise.
RETURNS (Dict[str, Any]): A dictionary containing the scores, with
inapplicable scores as None:
for all:
attr_score (one of attr_micro_f / attr_macro_f / attr_macro_auc),
attr_score_desc (text description of the overall score),
attr_micro_p,
attr_micro_r,
attr_micro_f,
attr_macro_p,
attr_macro_r,
attr_macro_f,
attr_macro_auc,
attr_f_per_type,
attr_auc_per_type
DOCS: https://spacy.io/api/scorer#score_cats
Ngà?rWrr
có |dS©Nr
rS©Úits r(ú<lambda>z#Scorer.score_cats.<locals>.<lambda>ó ÈrÐRSÊur*)Úkeycó |dSrSs r(z#Scorer.score_cats.<locals>.<lambda>r*có |dSrSs r(z#Scorer.score_cats.<locals>.<lambda>sÀrÈ!Âur*có |dSrSs r(z#Scorer.score_cats.<locals>.<lambda>r*r=c3ó4K|]}|jŒy­wr&©r>©Ú.0Úprfs r(ú <genexpr>z$Scorer.score_cats.<locals>.<genexpr>"óèø€ÐCÑ/B¨c—m•mÑ/Bùóc3ó4K|]}|jŒy­wr&©rAs r(z$Scorer.score_cats.<locals>.<genexpr>#óèø€Ð@Ñ,? Sc—j•jÑ,?ùrëc3ó4K|]}|jŒy­wr&©rFs r(z$Scorer.score_cats.<locals>.<genexpr>$c3óXK|]"}|j«r |jndŒ$y­w)rWN)rbrj)Úaucs r(z$Scorer.score_cats.<locals>.<genexpr>(s$èø€ÐWÑAV¸#˜SŸ]™]œ_ °#Ó5ÑAVùs(*Ú_scoreÚ _score_descr¨Ú_macro_pÚ_macro_rÚ_macro_fÚ
_macro_aucÚ _f_per_typeÚ
_auc_per_typerCrHzF (ú)zmacro Fz macro AUC)rrUrOr…r„r:r!r"r#Úmaxrºr7Úsumr>rArFrIrbrj)rvrr™r×rrreÚ
f_per_typeÚ auc_per_typerÚ pred_catsr½Ú gold_catsÚ
pred_scoreÚ
gold_scoreÚ
pred_labelÚ
gold_labelÚ micro_prfÚ label_prfÚn_catsÚmacro_pÚmacro_rÚmacro_fÚ macro_aucÚresultsÚpositive_label_fs r(Ú
score_catszScorer.score_cats¾s}ð\ Ð Ù*™°ˆIÙØˆIÙ5;Ó<±V¨EeœX'°Vˆ
Ð<Ù:@ÓA¹&°˜œ{,¸ ÐV“ˆÜˆGá˜w×0°$Ó7ˆIØ*3¯/©/Ô*;ÔKÑ*;¡$ ! Q¸qÀFº{˜˜A™Ð*;ˆIјw×0°$Ó7ˆIØ*3¯/©/Ô*;ÔKÑ*;¡$ ! Q¸qÀFº{˜˜A™Ð*;ˆØ&Ÿ]™]¨5°#Ó6
Ø&Ÿ]™]¨5Ó1
Ù!©+Ø!$Ñ  Ñ'×1°*¸
 ñÛ#EØ!*§¡¨u°cÓ!:JØ!*§¡¨uÓ!5Ò2°zÀA²~Ø& -×0°AÑ'¨9Ò4¸ÀqºØ& -×0°AÑ'¨)Ó3¸
ÀQ»Ø& -×0°AÑ™yä),¨Y¯_©_Ó->ÑDTÔ)UÑ&
˜JÜ),¨Y¯_©_Ó->ÑDTÔ)UÑ&
˜JØ Ò˜zÑјzÑјzÑÑ2×Ü),¨YÑ<LÔ)MÑ&
˜ ”>ؘzÑÑ2×Ü),¨Y¯_©_Ó->ÑDTÔ)UÑ&
˜˜&×)¨QÑ.×)ðQ ôR“Jˆ Ø#×,ˆ LŠL˜IŸL™LÑ ( LŠL˜IŸL™LÑ ( LŠL˜IŸL™LÑ (ŽLðZ“ 6Ñ)ˆÜÑC¨z×/@Ñ/@Ô/BÓCÀfÑLˆÜÑ@¨J×,=Ñ,=Ô,?Ó@À6ÑIˆÜÑ@¨J×,=Ñ,=Ô,?Ó@À6ÑIˆô
Ñ×ATÑATÔAVÓ ñ
ð ð
ˆfFˆO˜T؈f  $؈f ˜y׈f ˜y׈f ˜y׈f ˜w؈f ˜w؈f ˜w؈f  Øˆf ¸j×>NÑ>NÔ>PÔ"QÑ>P±d°a¸ 1 a§i¡i£k¡>Ð>PÒ"Q؈f "ØBN×BTÑBTÔBVô%ÙBV¹$¸!¸Q˜aŸk™kœm1—7Ñ5ÐBVò%ð#
ˆô ˆv;˜!Ò ¡K±NØ&¨$¨¨{Ð';Ñ<¸LÈSÑ Ø'7ˆGtf˜F $Ø.1°.Ð1AÀÐ,CˆGtf˜ ˆñ
Ø'.°$°°xÐ/@Ñ'AˆGtf˜F $Ø,5ˆGtf˜ ˆð(/°$°°zÐ/BÑ'CˆGtf˜F $Ø,7ˆGtf˜ ˆùòi=ùÚAùó
LùãKùóz#Rùó%s.S/©S4Á4 S9ÂS9Â/ S?Â<S?Ð$T)T negative_labelsc óti}|D]J}i}|jjD]}|||j|jf<Œ|jjD}|j |j|jfd«}|Œ.|j } | |vr
t«|| <|j}
|
ŒZ|j} |
|vr| |vrŒo|
| k(r|| xjdz
c_ Œ|
|vr|| xjdz
c_
λ| |vr|| xjdz
c_ ΂|| xjdz
c_
|| xjdz
c_ ŒøŒMt«} |j«D]_}
| xj|
jz
c_ | xj|
jz
c_ | xj|
jz
c_
Œat|«dz}td|j«D««|z }td|j«D««|z }td|j«D««|z }d| jdd d
| j d | j"d | jd
|d|d|d|j%«Dcic]\}}||j'«Œc}}i }|Scc}}w)aReturns PRF for predicted links on the entity level.
To disentangle the performance of the NEL from the NER,
this method only evaluates NEL links for entities that overlap
between the gold reference and the predictions.
examples (Iterable[Example]): Examples to score
negative_labels (Iterable[str]): The string values that refer to no annotation (e.g. "NIL")
RETURNS (Dict[str, Any]): A dictionary containing the scores.
DOCS: https://spacy.io/api/scorer#score_links
Nr
r=c3ó4K|]}|jŒy­wr&s r(z%Scorer.score_links.<locals>.<genexpr>{c3ó4K|]}|jŒy­wr&s r(z%Scorer.score_links.<locals>.<genexpr>|c3ó4K|]}|jŒy­wr&s r(z%Scorer.score_links.<locals>.<genexpr>}Ú nel_scoreÚnel_score_desczmicro FÚ nel_micro_pÚ nel_micro_rÚ nel_micro_fÚ nel_macro_pÚ nel_macro_rÚ nel_macro_fÚnel_f_per_type)r„ÚentsÚ
start_charÚend_charr…rÚkb_id_r!r"r#r7rFr>rArI)rvrrrrÚgold_ent_by_offsetÚgold_entÚpred_entrÑrer5ÚpredrrÚn_labelsr r
r r
s r(Ú score_linkszScorer.score_linksFðˆ
܈GØ!#Ð Ø-×2ØOWÐ" H×$7Ñ$7¸×9JÑ9JÐ#KÒ$×2Ø.××(¨(×*;Ñ*;Ð<¸ ðÑ, .Ü,4«J˜
 $×+јؠ2°t¸Ñ7Nà Ø! Tš\Ø& -×0°AÑ! & -×0°AÑ! & -×0°AÑ' -×0°AÑ& -×0°AÑ0ò3  ô>“Jˆ Ø#×,ˆ LŠL˜IŸL™LÑ ( LŠL˜IŸL™LÑ ( LŠL˜IŸL™LÑ (ŽLðz“? +ˆÜÑC¨z×/@Ñ/@Ô/BÓCÀhÑNˆÜÑ@¨J×,=Ñ,=Ô,?Ó@À8ÑKˆÜÑ@¨J×,=Ñ,=Ô,?Ó@À8Ñà˜)טyؘIטIטIטGؘGؘGظ:×;KÑ;KÔ;MÔNÑ;M±4°1°a  1§9¡9£;¡Ð;MÒ

ˆðˆùó OsÊJ4(Úhead)r™Ú head_attrÚ head_getterÚ
ignore_labelsršr)r*r+c óöt«}t«} t«}
t«} |D} | j}
| j}| j
}t«}i}t
|
«D]“\}}|||«}|||«}||vrg||vsŒ!|j||j|f«||
vr
t«|
|<||vr
t«||<||j||j|f«Œƒ| j|«Œ•t«}i}|D]\}|jj«rŒ|jj|jdk7rd}n|j|jd}|| vsŒi|||«}|||«}||vsŒ€|jj«sŒ›|jj|jdk(r|j|jd}nd}||€,|xjdz
c_| xjdz
c_Œ|j|||f«||
vr
t«|
|<||vr
t«||<||j|||f«Œ_| j||«|
D]G}|
|j|j!|t««|j!|t«««ŒI|jtd|D««td|D«««ŒÕt#|«dkDrU|d|j$|d| j$|d|
j'«Dcic]\}}||j)«Œc}}iS|dd|dd|ddiScc}}w) a2Returns the UAS, LAS, and LAS per type scores for dependency
parses.
examples (Iterable[Example]): Examples to score
attr (str): The attribute containing the dependency label.
getter (Callable[[Token, str], Any]): Defaults to getattr. If provided,
getter(token, attr) should return the value of the attribute for an
individual token.
head_attr (str): The attribute containing the head token. Defaults to
'head'.
head_getter (Callable[[Token, str], Token]): Defaults to getattr. If provided,
head_getter(token, attr) should return the value of the head for an
individual token.
ignore_labels (Tuple): Labels to ignore while scoring (e.g., punct).
missing_values (Set[Any]): Attribute values to treat as missing annotation
in the reference annotation.
RETURNS (Dict[str, Any]): A dictionary containing the scores:
attr_uas, attr_las, and attr_las_per_type.
DOCS: https://spacy.io/api/scorer#score_deps
r
Nrc3ó&K|] }|ddŒ y­wr_rS©Úitems r(z$Scorer.score_deps.<locals>.<genexpr>æsèø€Ð ˜!”H©ùóc3ó&K|] }|ddŒ y­wr_rSr.s r(z$Scorer.score_deps.<locals>.<genexpr>æsèø€Ð8XÉiÀd¸¸b¸q¼Éiùr0Ú_uasÚ_lasÚ
_las_per_type)rrOr„r…r‡r‰rÚstripr"r:r7rFrI)rvrr™r)r*r+rrÚ
unlabelledÚlabelledÚlabelled_per_depr¡rrr“r”Ú gold_depsÚgold_deps_per_depr¢r—Údepr(Ú pred_depsÚpred_deps_per_depÚ gold_headr½s r(Ú
score_depszScorer.score_depss|ôB“Zˆ
Ü“:ˆÜ›6ÐÜ›%ˆÜˆGØ×(ˆHØ×(ˆHØ×%ˆE܈IØ02Ð Ü!*¨8Ö!4
˜Ù˜U )Ù" 5¨)Ó4ؘ -Ò
 v¨t¯v©v°sÐ&;ÔÐ&6Ñ6Ü4<³JÐ,¨SÑÐ&7Ñ7Ü58³UÐ-¨cÑ)¨#Ñ.×2°F¸D¿F¹FÀCÐ3HÕ#×Õ"5ôˆIØ02Ð Ü!Ø—;;ר—99×$ U§W¡WÑÒ!"ŸY™Y u§w¡wÑÑ2 Ò  ¨Ó-& u¨iÓ8 /°E·K±K×4EÑ4EÕ4GØ Ÿ9™9×,¨T¯V©VÑ4¸Ò9Ø(-¯ © °$·&±&Ñ(9¸!Ñ(<™Ià(,˜"˜>¨YÐ->Ø&ŸMšM¨QÑ.$ŸKšK¨1Ñ,ŸKà%ŸM™M¨6°9¸cÐ*BÔ"Ð*:Ñ:Ü8@»
Ð 0°Ñ 5Ø"Ð*;Ñ;Ü9<»Ð 1°#Ñ 6Ø-¨cÑ2×6¸À È3Ð7OÖPð5"ð6
× Ñ ˜y¨)Ô 'Ø  Ñ%×%×)¨#¬s«uÓ5Ð7H×7LÑ7LÈSÔRUÓRWÓ7Xõð
× Ñ ÜÑÓ3´SÑ8XÉiÓ8XÓ5Xö
ðk ôp ˆz?˜ à&˜
˜z×&˜
˜Ø&˜
Ð&Ø/?×/EÑ/EÔ/Gô)Ù/G¡t q¨!Aq—yy“{NÐ/Gò)ðð
ð&˜
˜&˜
˜&˜
Ððð
ùó )sÍM5)rJrKrLrMÚDEFAULT_PIPELINEr
rRrr)rÚboolrrrjÚ staticmethodr˜ÚgetattrÚMISSING_VALUESrrr r¿rrrrQrr'r?rSr*r(rlrlos´Ù%)Ø Ø*:ñ à

ððð# 3™-ð ð
ó
ð*EJòØ  ÑØ=Aðà
ˆc3ˆh‰óð4ð/ X¨gÑ%6ð/À$ÀsÈCÀxÁ.ò/óð/ðbð
/6Ø#1ò 0˜0ð0˜% ˜ +ð 0
˜C™ð 0
ˆc3ˆh‰ò0ð01ðdð
/6Ø#1ò QؘQàðQð˜% ˜ sÐ+ð Qð
˜C™ð Qð
ˆc3ˆh‰òQóðQðfð
8?Ø:>ØØbؘbàðbð˜#˜s˜ X¨d¡^Ð4ð bð
! ¨3¨%°¨+Ñ!6Ñ bð ð
bððbð
ˆc3ˆh‰òbóðbðHð
-4Ù 0Ó 2Ø Ø(,Ø%)òEؘ7ÑEàðEð˜#˜s˜ S˜Ñ)ð Eð
˜
ð Eð ð
Eð! 
ðEð˜E‘?ðEð
ˆc3ˆh‰òEóðEðNðBؘ7ÑBØ9AÀ#¹ðBà
ˆc3ˆh‰òBóðBðHð
/6ØØ5<Ù'7Ó'9Ø#1òiؘiàðið˜% ˜ sÐ+ð ið
ð ið ˜u c˜l¨EÐ
ið  ‘}ðið˜C™ðið
ˆc3ˆh‰òióñir*rlrvr$c
óštt«}|D}|jjd«sŒ |jjDchc]%}|j
|j |jfŒ'}}|jj}|jjD}|j
|vrt«||j
<||j |j}t|«sŒM|j|d|ddz} td| D««sŒx|j
|d|ddzf}
|
|vr4||j
xjdz
c_
|j|
«ŒÈ||j
xjdz
c_Α|D]\} } }
|| xj dz
c_Œ Œ¡t«}|j#«D]}||z
}Œ t|«dkDrU|j$|j&|j(|j+«Dcic]\}}||j-«Œc}}dœSdddddœScc}wcc}}w)zGCompute micro-PRF and per-entity PRF scores for a sequence of examples.ÚENT_IOBréÿÿÿÿr
c3ó:K|]}|jdk7Œy­w)rN)Úent_iob)r—s r(zget_ner_prf.<locals>.<genexpr> sèø€Ð>±v¨eu—}‘}¨Õ)±vùs)Úents_pÚents_rÚents_fÚ
ents_per_typeN)rrÚyrÀrr‡Úxr7Úallr!Úremover"r#r>rArFrI)rvÚkwargsrÍÚegÚerXÚ align_x2yr$ÚindicesÚg_spanràreÚtotalsrès r(Ú get_ner_prfrYøs
ä ¤Ó*€N܈Øt‰t×"  Ø57·T±T·Y²YÓ?±Y°!—((˜AŸG™G Q§U¡UÒ+°YˆÐ—L‘L×$ˆ ØŸŸ œ ˆHØ nÑ4Ü2:³*˜xŸÑ §¡°·±Ð>ˆGÜ7Ÿ˜g a™j¨7°2©;¸©?Ð;ôÑ>±vÓ#Ÿ?™?¨G°A©J¸À¹ Àa¹ÐH˜e‘|Ø& ¡Ñ:¸Ÿ  & ¡Ñ7×:¸"'Ñ ˆE5˜ ˜ !× Ñ "'ð+ô.Z€FØ×&ˆØ#‰
ð
ˆ6ƒ{Qà×—m—mmØ9G×9MÑ9MÔ9OÔPÑ9O±°°A˜§¡£™nÐ9OÒ
ð
ðØØØ
ð
ùò?@ùó8Qs Á
*IÈI c ó.tj|«}||}n„tj|«}|jdk(rItj|«}dg|jz}|jd||<|j |«}ntj||¬«}|j}t
d«g|z}t
d«g|z}t
dd«||<t
dd«||< ||t|«|t|«zzdz j|«} | S#t$rotj|«}tj|«}tjj||t|«|t|«zzdz |«} Y| SwxYw)a
Integrate along the given axis using the composite trapezoidal rule.
If `x` is provided, the integration happens in sequence along its
elements - they are not sorted.
Integrate `y` (`x`) along each 1d slice on the given axis, compute
:math:`\int y(x) dx`.
When `x` is specified, this integrates along the parametric curve,
computing :math:`\int_t y(t) dt =
\int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`.
Parameters
----------
y : array_like
Input array to integrate.
x : array_like, optional
The sample points corresponding to the `y` values. If `x` is None,
the sample points are assumed to be evenly spaced `dx` apart. The
default is None.
dx : scalar, optional
The spacing between sample points when `x` is None. The default is 1.
axis : int, optional
The axis along which to integrate.
Returns
-------
trapezoid : float or ndarray
Definite integral of `y` = n-dimensional array as approximated along
a single axis by the trapezoidal rule. If `y` is a 1-dimensional array,
then the result is a float. If `n` is greater than 1, then the result
is an `n`-1 dimensional array.
See Also
--------
cumulative_trapezoid, simpson, romb
Notes
-----
Image [2]_ illustrates trapezoidal rule -- y-axis locations of points
will be taken from `y` array, by default x-axis distances between
points will be 1.0, alternatively they can be provided with `x` array
or with `dx` scalar. Return value will be equal to combined area under
the red lines.
References
----------
.. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule
.. [2] Illustration image:
https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png
Examples
--------
Use the trapezoidal rule on evenly spaced points:
>>> import numpy as np
>>> from scipy import integrate
>>> integrate.trapezoid([1, 2, 3])
4.0
The spacing between sample points can be selected by either the
``x`` or ``dx`` arguments:
>>> integrate.trapezoid([1, 2, 3], x=[4, 6, 8])
8.0
>>> integrate.trapezoid([1, 2, 3], dx=2)
8.0
Using a decreasing ``x`` corresponds to integrating in reverse:
>>> integrate.trapezoid([1, 2, 3], x=[8, 6, 4])
-8.0
More generally ``x`` is used to integrate along a parametric curve. We can
estimate the integral :math:`\int_0^1 x^2 = 1/3` using:
>>> x = np.linspace(0, 1, num=50)
>>> y = x**2
>>> integrate.trapezoid(y, x)