
    ipa              	          d dl Z d dlmZ d dlmZ d dlmZmZmZm	Z	m
Z
mZmZmZmZ d dlZd dlmZmZmZmZmZmZ d dlmZmZmZmZ ddlmZmZ dd	l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*m+Z+ ddl,m-Z- ddl.m/Z/ dZ0dZ1dZ2 e       jg                  e0      d   Z4 e       jg                  e1      d   Z5e G d de             Z6ddde	e&   de
e7   dee   defdZ8ddde	e&   de9dee   defdZ:de
e7   de6fdZ;d e7d!e7de6fd"Z<de9de6fd#Z=d$e	e*   dee9ef   fd%Z>d& Z?e G d' d(             Z@ G d) d*e/      ZAd+ ZBy),    N)	dataclass)partial)	AnyCallableDictIterableListOptionalTupleUnioncast)ConfigModelOps	Optimizerget_current_opsset_dropout_rate)Floats2dInts1dInts2dRagged   )Protocolruntime_checkable)Errors)Language)Scorer)DocSpan	SpanGroup)Examplevalidate_examples)Vocab   )TrainablePipea4  
[model]
@architectures = "spacy.SpanCategorizer.v1"
scorer = {"@layers": "spacy.LinearLogistic.v1"}

[model.reducer]
@layers = spacy.mean_max_reducer.v1
hidden_size = 128

[model.tok2vec]
@architectures = "spacy.Tok2Vec.v2"

[model.tok2vec.embed]
@architectures = "spacy.MultiHashEmbed.v2"
width = 96
rows = [5000, 1000, 2500, 1000]
attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"]
include_static_vectors = false

[model.tok2vec.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = ${model.tok2vec.embed.width}
window_size = 1
maxout_pieces = 3
depth = 4
a&  
[model]
@architectures = "spacy.SpanCategorizer.v1"
scorer = {"@layers": "Softmax.v2"}

[model.reducer]
@layers = spacy.mean_max_reducer.v1
hidden_size = 128

[model.tok2vec]
@architectures = "spacy.Tok2Vec.v2"
[model.tok2vec.embed]
@architectures = "spacy.MultiHashEmbed.v1"
width = 96
rows = [5000, 1000, 2500, 1000]
attrs = ["NORM", "PREFIX", "SUFFIX", "SHAPE"]
include_static_vectors = false

[model.tok2vec.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = ${model.tok2vec.embed.width}
window_size = 1
maxout_pieces = 3
depth = 4
scmodelc                   2    e Zd Zdddee   dee   defdZy)	SuggesterNopsdocsr+   returnc                     y N )selfr,   r+   s      g/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/spacy/pipeline/spancat.py__call__zSuggester.__call__Q   s        )	__name__
__module____qualname__r   r   r
   r   r   r3   r0   r4   r2   r)   r)   O   s    DHXXc]XHSMXVXr4   r)   r*   r,   sizesr+   r-   c          	         |
t               }g }g }| D ]  }|j                  j                  t        |      d      }|j	                  d      }d}|D ]  }|t        |      k  rX|d t        |      |dz
  z
   }	|j                  |j                  j                  |	|	|z   f             ||d   j                  d   z  }|sl|d   j                  dk(  rJ |d   j                          |j                  |        |j                  |      }
t        |      dkD  r&t        |j                  j                  |      |
      }n't        |j                  j                  dd      |
      }|j                  j                  dk(  sJ |S )	Nidtype)r$   r   r$   r=   r   r   r   )r   xparangelenreshapeappendhstackshapendim	asarray1ir   vstackzerosdataXd)r,   r8   r+   spanslengthsdocstartslengthsizestarts_sizelengths_arrayoutputs               r2   ngram_suggesterrT   T   sh    {EG s3xs3( 	<Ds3x$%<s3x4!8'<=SVV]]Kt9K+LMN%)//!,,Ry~~*;E"IOO;*	< 	v MM'*M
5zA~e,m<V37G=="""Mr4   	spans_keyc                   |
t               }g }g }| D ]d  }d}|j                  |   r@|j                  |   D ].  }|j                  |j                  |j                  g       |dz  }0 |j                  |       f t        t        |j                  |d            }t        |      dkD  rt        |j                  |d      |      }	|	S t        |j                  j                  dd      |      }	|	S )Nr   r$   r:   r;   r>   )r   rK   rC   startendr   r   asarrayrA   r   r?   rI   )
r,   rU   r+   rK   rL   rM   rO   spanrR   rS   s
             r2   preset_spans_suggesterr[   q   s     {EG 99Y		), djj$((34! 	v WC!@AM
5zA~E5}E M V37GMr4   c                 $    t        t        |       S )zSuggest all spans of the given lengths. Spans are returned as a ragged
    array of integers. The array has two columns, indicating the start and end
    position.r8   )r   rT   r]   s    r2   build_ngram_suggesterr^      s    
 ?%00r4   min_sizemax_sizec                 H    t        t        | |dz               }t        |      S )zSuggest all spans of the given lengths between a given min and max value - both inclusive.
    Spans are returned as a ragged array of integers. The array has two columns,
    indicating the start and end position.r$   )listranger^   )r_   r`   r8   s      r2   build_ngram_range_suggesterrd      s$     xA./E ''r4   c                 $    t        t        |       S )zSuggest all spans that are already stored in doc.spans[spans_key].
    This is useful when an upstream component is used to set the spans
    on the Doc such as a SpanRuler or SpanFinder.rU   )r   r[   rf   s    r2   build_preset_spans_suggesterrg      s     )Y??r4   examplesc                     t        |      }d|d   |j                  d         |j                  dd       |j                  dfd       |j                  dfd	       t        j                  | fi |S )
Nspans_rU   attrallow_overlapTgetterc                 T    | j                   j                  |t              d  g       S r/   )rK   getrA   )rM   keyattr_prefixs     r2   <lambda>zspancat_score.<locals>.<lambda>   s#    399==S5E5G1H"#M r4   has_annotationc                      | j                   v S r/   )rK   )rM   rp   s    r2   rr   zspancat_score.<locals>.<lambda>   s    C3994D r4   )dict
setdefaultr   score_spans)rh   kwargsrq   rp   s     @@r2   spancat_scorery      s    &\FK

C
fcU34
ot,
M &(DEh1&11r4   c                      t         S r/   )ry   r0   r4   r2   make_spancat_scorerr{      s    r4   c                   "    e Zd ZdZd Zd Zd Zy)
_Intervalsz:
    Helper class to avoid storing overlapping spans.
    c                 "    t               | _        y r/   )setrangesr1   s    r2   __init__z_Intervals.__init__   s    er4   c                 \    t        ||      D ]  }| j                  j                  |        y r/   )rc   r   add)r1   r:   jes       r2   r   z_Intervals.add   s'    q! 	AKKOOA	r4   c                 P    |\  }}t        ||      D ]  }|| j                  v s y y)NTF)rc   r   )r1   rangr:   r   r   s        r2   __contains__z_Intervals.__contains__   s4    1q! 	ADKK	 r4   N)r5   r6   r7   __doc__r   r   r   r0   r4   r2   r}   r}      s    r4   r}   c                      e Zd ZdZ	 d<ddddddedd	ed
eeee	   e
f   ef   dededededee   dee   dee   dee   dee   ddfdZedefd       Zd=dZdedefdZedee   fd       Zedee   fd       Zedeeef   fd       Zedefd       Zedeedf   fd       Zdee	   fd Z d!d"dee	   d#eddfd$Z!dee	   ddfd%Z"d&ddd'd(ee#   d)ed*ee$   d+eeeef      deeef   f
d,Z%d(ee#   d-ee
ef   deeef   fd.Z&ddd/d0eg ee#   f   d1ee'   d2eee      ddfd3Z(d(ee#   fd4Z)d5e#fd6Z*d7e	d8e+d9ede,fd:Z-	 d>d7e	d8e+d9edede,f
d;Z.y)?SpanCategorizerz_Pipeline component to label spans of text.

    DOCS: https://spacy.io/api/spancategorizer
    FrK         ?TNg      ?)add_negative_labelrU   negative_weightrl   max_positive	thresholdscorervocabr'   	suggesternamer   rU   r   rl   r   r   r   r-   c                    g ||
|	||d| _         || _        || _        || _        || _        || _        || _        |s2|	/|	dkD  r)t        t        j                  j                  |	            yyy)a}  Initialize the multi-label or multi-class span categorizer.

        vocab (Vocab): The shared vocabulary.
        model (thinc.api.Model): The Thinc Model powering the pipeline component.
            For multi-class classification (single label per span) we recommend
            using a Softmax classifier as a the final layer, while for multi-label
            classification (multiple possible labels per span) we recommend Logistic.
        suggester (Callable[[Iterable[Doc], Optional[Ops]], Ragged]): A function that suggests spans.
            Spans are returned as a ragged array with two integer columns, for the
            start and end positions.
        name (str): The component instance name, used to add entries to the
            losses during training.
        spans_key (str): Key of the Doc.spans dict to save the spans under.
            During initialization and training, the component will look for
            spans on the reference document under the same key. Defaults to
            `"spans"`.
        add_negative_label (bool): Learn to predict a special 'negative_label'
            when a Span is not annotated.
        threshold (Optional[float]): Minimum probability to consider a prediction
            positive. Defaults to 0.5. Spans with a positive prediction will be saved
            on the Doc.
        max_positive (Optional[int]): Maximum number of labels to consider
            positive per span. Defaults to None, indicating no limit.
        negative_weight (float): Multiplier for the loss terms.
            Can be used to downweight the negative samples if there are too many
            when add_negative_label is True. Otherwise its unused.
        allow_overlap (bool): If True the data is assumed to contain overlapping spans.
            Otherwise it produces non-overlapping spans greedily prioritizing
            higher assigned label scores. Only used when max_positive is 1.
        scorer (Optional[Callable]): The scoring method. Defaults to
            Scorer.score_spans for the Doc.spans[spans_key] with overlapping
            spans allowed.

        DOCS: https://spacy.io/api/spancategorizer#init
        )labelsrU   r   r   r   rl   Nr$   )r   )cfgr   r   r'   r   r   r   
ValueErrorr   E1051format)r1   r   r'   r   r   r   rU   r   rl   r   r   r   s               r2   r   zSpanCategorizer.__init__   s    f ""(.*
 
"
	"4!9lQ>NV\\00l0KLL ?O!9}r4   c                 2    t        | j                  d         S )zKey of the doc.spans dict to save the spans under. During
        initialization and training, the component will look for spans on the
        reference document under the same key.
        rU   )strr   r   s    r2   rp   zSpanCategorizer.key  s     488K())r4   c                 ,   d}| j                   j                  d      r| j                   j                  d      }no| j                   j                  d      rT| j                   j	                  d      j                  d      r*| j                   j	                  d      j                  d      }|j|| j
                  k(  rZ| j                  sMt        t        j                  j                  | j                  | j                   j                  d                  yyy)z<Raise an error if the component can not add any more labels.NnOoutput_layer)r   r   )r'   has_dimget_dimhas_refget_ref	_n_labelsis_resizabler   r   E922r   r   )r1   r   s     r2   _allow_extra_labelz"SpanCategorizer._allow_extra_label  s    ::d###D)BZZ/DJJ4F4F5

'$-5 ##N3;;DAB>bDNN2$$ KK&&DII$**:L:LT:R&S  % 3>r4   labelc                    t        |t              st        t        j                        || j
                  v ry| j                          | j                  d   j                  |       | j                  j                  j                  |       y)zAdd a new label to the pipe.

        label (str): The label to add.
        RETURNS (int): 0 if label is already present, otherwise 1.

        DOCS: https://spacy.io/api/spancategorizer#add_label
        r   r   r$   )
isinstancer   r   r   E187r   r   r   rC   r   stringsr   )r1   r   s     r2   	add_labelzSpanCategorizer.add_label%  sj     %%V[[))DKK!!!%(

u%r4   c                 2    t        | j                  d         S )zRETURNS (Tuple[str]): The labels currently added to the component.

        DOCS: https://spacy.io/api/spancategorizer#labels
        r   )tupler   r   s    r2   r   zSpanCategorizer.labels6  s     TXXh'((r4   c                 ,    t        | j                        S )zRETURNS (List[str]): Information about the component's labels.

        DOCS: https://spacy.io/api/spancategorizer#label_data
        )rb   r   r   s    r2   
label_datazSpanCategorizer.label_data>  s     DKK  r4   c                 `    t        | j                        D ci c]  \  }}||
 c}}S c c}}w )z(RETURNS (Dict[str, int]): The label map.)	enumerater   )r1   r:   r   s      r2   
_label_mapzSpanCategorizer._label_mapF  s)     *34;;)?@XQq@@@s   *c                 t    | j                   rt        | j                        dz   S t        | j                        S )z RETURNS (int): Number of labels.r$   )r   rA   r   r   s    r2   r   zSpanCategorizer._n_labelsK  s0     ""t{{#a''t{{##r4   c                 F    | j                   rt        | j                        S y)z8RETURNS (Union[int, None]): Index of the negative label.N)r   rA   r   r   s    r2   _negative_label_iz!SpanCategorizer._negative_label_iS  s     ""t''r4   r,   c                     | j                  || j                  j                        }|j                  j	                         dk(  r*| j                  j                  j                  dd      }||fS | j                  j                  ||f      }||fS )zApply the pipeline's model to a batch of docs, without modifying them.

        docs (Iterable[Doc]): The documents to predict.
        RETURNS: The models prediction for each document.

        DOCS: https://spacy.io/api/spancategorizer#predict
        r*   r   )r   r'   r+   rL   sumalloc2fpredict)r1   r,   indicesscoress       r2   r   zSpanCategorizer.predict[  s}     ..4::>>.:?? A%ZZ^^++Aq1F  ZZ''w8Fr4   
candidates)candidates_keyr   c                   | j                  || j                  j                        }t        ||      D ]L  \  }}g |j                  |<   |j
                  D ])  }|j                  |   j                  ||d   |d           + N y)ao  Use the spancat suggester to add a list of span candidates to a list of docs.
        This method is intended to be used for debugging purposes.

        docs (Iterable[Doc]): The documents to modify.
        candidates_key (str): Key of the Doc.spans dict to save the candidate spans under.

        DOCS: https://spacy.io/api/spancategorizer#set_candidates
        r*   r   r$   N)r   r'   r+   ziprK   rJ   rC   )r1   r,   r   suggester_outputr   rM   indexs          r2   set_candidateszSpanCategorizer.set_candidatesj  s      >>$DJJNN>C"#3T: 	KOJ(*CIIn%#** K		.)00U1Xa1IJK	Kr4   c           
         |\  }}d}t        |      D ]  \  }}||   j                  }t        t        | j                  d         }	| j                  d   dk(  r?| j                  ||||||j                  |   z    |	      |j                  | j                  <   n=| j                  ||||||j                  |   z          |j                  | j                  <   ||j                  |   z  } y)a  Modify a batch of Doc objects, using pre-computed scores.

        docs (Iterable[Doc]): The documents to modify.
        scores: The scores to set, produced by SpanCategorizer.predict.

        DOCS: https://spacy.io/api/spancategorizer#set_annotations
        r   rl   r   r$   N)
r   rJ   r   boolr   _make_span_group_singlelabelrL   rK   rp   _make_span_group_multilabel)
r1   r,   indices_scoresr   r   offsetr:   rM   	indices_irl   s
             r2   set_annotationszSpanCategorizer.set_annotations|  s     )o 	)FAs
))I txx'@AMxx'1,&*&G&G6FW__Q-?$?@!	'		$((# '+&F&F6FW__Q-?$?@'		$((#
 gooa((F!	)r4           )dropsgdlossesrh   r   r   r   c                n   |i }|j                  | j                  d       t        |d       | j                  |       t	        d |D              s|S |D cg c]  }|j
                   }}| j                  || j                  j                        }|j                  j                         dk(  r|S t        | j                  |       | j                  j                  ||f      \  }}	| j                  |||f      \  }
} |	|       || j                  |       || j                  xx   |
z  cc<   |S c c}w )a1  Learn from a batch of documents and gold-standard information,
        updating the pipe's model. Delegates to predict and get_loss.

        examples (Iterable[Example]): A batch of Example objects.
        drop (float): The dropout rate.
        sgd (thinc.api.Optimizer): The optimizer.
        losses (Dict[str, float]): Optional record of the loss during training.
            Updated using the component name as the key.
        RETURNS (Dict[str, float]): The updated losses dictionary.

        DOCS: https://spacy.io/api/spancategorizer#update
        r   zSpanCategorizer.updatec              3   b   K   | ]'  }|j                   rt        |j                         nd  ) yw)r   N)	predictedrA   ).0egs     r2   	<genexpr>z)SpanCategorizer.update.<locals>.<genexpr>  s$     O3r||$!;Os   -/r*   r   )rv   r   r"   _validate_categoriesanyr   r   r'   r+   rL   r   r   begin_updateget_lossfinish_update)r1   rh   r   r   r   r   r,   rK   r   backprop_scoreslossd_scoress               r2   updatezSpanCategorizer.update  s   ( >F$))S)($<=!!(+OhOOM'/000t8==!#MT*"&**"9"94-"Hx%Ah!?s#tyyT! 1s   D2spans_scoresc                    |\  }}t        | j                  j                  j                  |j                        | j                  j                  j                  |j
                              }t        j                  |j                  |j                        }| j                  r"t        j                  |j                  d         }d}| j                  }t        |      D ]  \  }	}
i }||	   j                  }t        |j
                  |	         D ],  }t!        ||df         }t!        ||df         }||z   |||f<   . | j#                  |
      D ]L  }|j$                  |j&                  f}||v s ||   }||j(                     }d|||f<   | j                  sHd|<   N ||j
                  |	   z  } | j                  j                  j+                  |d      }| j                  r)t        j,                        d   }d||| j.                  f<   ||z
  }| j                  r/t1        t2        | j4                  d         }|dk7  r|xx   |z  cc<   t3        |dz  j7                               }||fS )	ak  Find the loss and gradient of loss for the batch of documents and
        their predicted scores.

        examples (Iterable[Examples]): The batch of examples.
        spans_scores: Scores representing the model's predictions.
        RETURNS (Tuple[float, float]): The loss and the gradient.

        DOCS: https://spacy.io/api/spancategorizer#get_loss
        r;   r   r$   r   r   fr   r   )r   r'   r+   to_numpydatarL   numpyrI   rE   r<   r   onesr   r   rJ   rc   int_get_aligned_spansrW   rX   label_rY   nonzeror   r   floatr   r   )r1   rh   r   rK   r   targetnegative_spansr   	label_mapr:   r   spans_indexspans_ir   rW   rX   	gold_spanrp   rowknegative_samplesr   
neg_weightr   s                           r2   r   zSpanCategorizer.get_loss  sK    %vJJNN##EJJ/1H1H1W
 V\\>"""ZZa:NOO	x( 	'EAr KAhooG5==+, 7GAqDM*'!Q$-(,2QJUCL)7 "44R8 2	 	6+%%c*C!)"2"23A%(F36N...1s+2 emmA&&F+	', ''c':""$}}^<Q??BF#T%;%;;< F?""eTXX.?%@AJS )*j8*hk&&()X~r4   )nlpr   get_examplesr   r   c                   g }||D ]  }| j                  |         |       D ]t  }|P|j                  j                  j                  | j                  g       D ]  }| j                  |j
                          t        |      dk  sd|j                  |       v | j                          |r|D cg c]  }|j                   }} t        dg      |      }	| j                  j                  j                  |	j                  j                  d   | j                         }
| j                  j#                  ||	f|
       y| j                  j#                          yc c}w )a|  Initialize the pipe for training, using a representative set
        of data examples.

        get_examples (Callable[[], Iterable[Example]]): Function that
            returns a representative sample of gold-standard Example objects.
        nlp (Optional[Language]): The current nlp object the component is part of.
        labels (Optional[List[str]]): The labels to add to the component, typically generated by the
            `init labels` command. If no labels are provided, the get_examples
            callback is used to extract the labels from the data.

        DOCS: https://spacy.io/api/spancategorizer#initialize
        N
   r$   r]   r   )XY)r   	referencerK   ro   rp   r   rA   rC   _require_labelsxr^   r'   r+   r   rJ   rE   r   
initialize)r1   r   r   r   subbatchr   r   rZ   r,   rK   r   s              r2   r   zSpanCategorizer.initialize  s+   & #% &u%&. 	$B~LL..22488R@ 0DNN4;;/08}r!#	$ 	#+,RBDD,D,4)4T:E

&&u||'9'9!'<dnnMAJJ!!T5MQ!7JJ!!# -s   1Ec                      y r/   r0   )r1   rh   s     r2   r   z$SpanCategorizer._validate_categories%  s    r4   r   c                     |j                  |j                  j                  j                  | j                  g       d      S )NT)rl   )get_aligned_spans_y2xr   rK   ro   rp   )r1   r   s     r2   r   z"SpanCategorizer._get_aligned_spans)  s:    ''LL""488R0 ( 
 	
r4   rM   r   r   c                 0   t        || j                        }|j                  dk(  r|S | j                  j                  j                  |      }| j                  j                  j                  |      }| j                  d   }| j                  d   }||k\  }|t        |t              sJ | j                  rot        j                  |dd| j                  f         }t        j                   |dd| j                  f<   |dz  j                         }	||dd| j                  f<   n|dz  j                         }	|	dd|df   }
t        |
      D ]  \  }}d|||f<    g }t!        |j"                  d         D ]z  }||df   }||df   }t        ||         D ]Y  \  }}|s	|| j                  k7  s|j%                  t'        |||| j(                  |   	             |j%                  |||f          [ | t        j*                  |      |j,                  d
<   |S )z5Find the top-k labels for each span (k=max_positive).r   r   r   r   Nr=   Fr$   r   r   )r    rp   rP   r'   r+   r   r   r   r   r   r   copyr   infargsortr   rc   rE   rC   r   r   arrayattrs)r1   rM   r   r   rK   r   r   keepsnegative_scoresrankedspan_filterr:   r   attrs_scoresrW   rX   r   keeps                     r2   r   z+SpanCategorizer._make_span_group_multilabel.  s     #DHH-;;!L((0**..))'2HH[)	xx/)##lC000&&"'**VAt7M7M4M-N"O5:YYJq$0001 2+..04Cq$0001 2+..0 LM!12K#K0 &3 %af& w}}Q'( 	:AAqDME!Q$-C$U1X. :4D222T#ucQ%PQ$++F1a4L9	:	: !&L 9Hr4   c           
         |j                   dk(  rt        || j                        S | j                  j                  j                  |      }| j                  j                  j                  |      }|j                  d      }t        j                  |t        j                  |d      d      }t        j                  |j                  t              }| j                  r#t        j                  ||| j                  k7        }| j                   d   }|'t        j                  |||k\  j#                               }|s5|j#                         dz  j%                         }	||	   }||	   }||	   }||	   }t'               }
t        || j                        }g }t)        |j                  d         D ]u  }||   s	||   }||df   }||df   }|s||f|
v r%|
j+                  ||       |j-                  ||          |j-                  t/        |||| j0                  |                w t        j2                  |      |j4                  d	<   |S )
z$Find the argmax label for each span.r   r  r$   )axisr;   r   r=   r  r   )rP   r    rp   r'   r+   r   argmaxr   take_along_axisexpand_dimsr   rE   r   r   logical_andr   r   squeezer
  r}   rc   r   rC   r   r   r  r  )r1   rM   r   r   rl   r   argmax_scoresr  r   sort_idxseenrK   r  r:   r   rW   rX   s                    r2   r   z,SpanCategorizer._make_span_group_singlelabelW  s    ;;!Stxx00((0**..))'2MMqM)	--E%%i3!
 

9??$7""%%eY$:P:P-PQEHH[)	 %%emy.H-Q-Q-STE%--/"4==?H)(3M!(+Ih'G(OE|#DHH-w}}Q'( 	JA8aLEAqDME!Q$-C 3<4'HHUC(a 01LLc5#T[[5GHI	J  !&L 9Hr4   )spancat)r-   N)T)/r5   r6   r7   r   ry   r#   r   r   r	   r   r   r   r)   r   r   r
   r   r   r   r   propertyrp   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   r   r    r   r   r0   r4   r2   r   r      s    AM $) +.(,&*%(%2AMAM U49f,-x78AM 	AM
 AM !AM AM "%AM  ~AM smAM E?AM "AM 
AMF *S * *s s " )c
 ) ) !DI ! ! ADcN A A $3 $ $ 5d#3  HSM   =IKSMK69K	K$)HSM )d )@ #'-1'7#' 	'
 i ' c5j)*' 
c5j	'R< )<9>vx?O9P<	ue|	<D #'&*$$r8G#445$$ h	$$
 c#$$ 
$$LXg-> 
W 

'' ' 	'
 
'\ #55 5 	5
 5 
5r4   r   c                     | dk(  r!t        j                  d      }|j                  S | dk(  r!t        j                  d      }|j                  S t	        dt
         d|        )Nmake_spancatzspacy.pipeline.factoriesmake_spancat_singlelabelzmodule z has no attribute )	importlibimport_moduler   r!  AttributeErrorr5   )r   modules     r2   __getattr__r&    sf    ~(()CD"""	+	+(()CD...
78*,>tfE
FFr4   )Cr"  dataclassesr   	functoolsr   typingr   r   r   r   r	   r
   r   r   r   r   	thinc.apir   r   r   r   r   r   thinc.typesr   r   r   r   compatr   r   errorsr   languager   r   r   tokensr   r   r    trainingr!   r"   r   r#   trainable_piper%   spancat_default_config"spancat_singlelabel_default_configDEFAULT_SPANS_KEYfrom_strDEFAULT_SPANCAT_MODEL!DEFAULT_SPANCAT_SINGLELABEL_MODELr)   r   rT   r   r[   r^   rd   rg   ry   r{   r}   r   r&  r0   r4   r2   <module>r8     s    !  T T T  V V 8 8 0    ) ) 1  ) 6& "4  ))*@A'J $*H$5$5&%	% !
 Y Y Y
 DH
3- $S	3;C=< BF
3-$'19#.1c 1y 1(# ( ( (@C @I @
2HW- 
2DcN 
2   (Gm GVGr4   