o
    i                     @   s   d dl mZmZ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 ee Ze
Zdeeee
 f deeef d	eeef fd
dZd	eee
 e
f fddZdS )    )CallableListTuple)Modelchain
with_array)Floats1dFloats2d   )Doc)registrytok2vecscorerreturnc                 C   s>   t |}t| |t }|d|  |d| |d| |S )Nr   r   logistic_layer)r   r   	flattenerset_ref)r   r   r   model r   O/home/ubuntu/.local/lib/python3.10/site-packages/spacy/ml/models/span_finder.pybuild_finder_model   s   r   c                  C   sH   dt ttf dtt dtdttttgtt f f fdd} t d| dS )	z4Flattens the input to a 1-dimensional list of scoresr   Xis_trainr   c                    sF   j dd |D  j |}dtdtt f fdd}||fS )Nc                 S   s   g | ]}t |qS r   )len).0docr   r   r   
<listcomp>    s    z.flattener.<locals>.forward.<locals>.<listcomp>dYr   c                    s   j |  S )N)ops	unflatten)r   lensr   r   r   backprop#   s   z,flattener.<locals>.forward.<locals>.backprop)r   	asarray1iflattenr	   r   )r   r   r   Yr"   r   r    r   forward   s   zflattener.<locals>.forward	Flattenerr&   )r   r   r   r	   boolr   r   r(   r   r   r   r      s   

r   N)typingr   r   r   	thinc.apir   r   r   thinc.typesr   r	   tokensr   utilr   InTOutTr   r   r   r   r   r   <module>   s    


