B
    .(b                 @   sP   d dl mZ d dlZddlmZ ejdd Zdd Zejd	d
 Zdd Z	dS )    )unicode_literalsN   )get_docc             C   s\   d}ddddddddddd	g}d
ddddd
dddddg}| |}t |jdd |D ||dS )Nz+He jests at scars, that never felt a wound.         r   r   nsubjZccomppreppobjpunctnegROOTdetdobjc             S   s   g | ]
}|j qS  )text).0tr   r   T/home/dcms/DCMS/lib/python3.7/site-packages/spacy/tests/regression/test_issue3962.py
<listcomp>   s    zdoc.<locals>.<listcomp>)wordsheadsdeps)r   vocab)en_tokenizerr   r   r   tokensr   r   r   doc	   s    r   c             C   s  | dd }|  }| }|s$t|d jjdks8t|d jdksJt|d jjdks^t|d jdkspt|d jjdkst|d jd	kst|d
 jjdkst|d
 jdksttt|jdkst| dd }|  }| }|st|d jjdkst|d jdks t|d jjdks6t|d jdksJt|d jjdks`t|d jdkstttt|jdkstdS )z Ensure that as_doc does not result in out-of-bound access of tokens.
    This is achieved by setting the head to itself if it would lie out of the span otherwise.r      r   jestsdepr   r   atr   r   r   	   Zfeltr   r   N)	as_docto_jsonAssertionErrorheadr   dep_lenlistsents)r   span2doc2	doc2_jsonZspan3Zdoc3Z	doc3_jsonr   r   r   test_issue3962   s0    r0   c             C   s\   d}dddddddddddg}dd	d
ddddd	dddg}| |}t |jdd |D ||dS )Nz+He jests at scars. They never felt a wound.r   r   r   r
   r   r	   r   r   r   r   r   r   r   r   c             S   s   g | ]
}|j qS r   )r   )r   r   r   r   r   r   V   s    z two_sent_doc.<locals>.<listcomp>)r   r   r   )r   r   )r   r   r   r   r   r   r   r   two_sent_docD   s    r1   c             C   sR  | dd }|  }| }|s$t|d jjdks8t|d jdksJt|d jjdks^t|d jdkspt|d jjdkst|d jd	kst|d
 jjdkst|d
 jdkst|d jjdkst|d jdkst|d jjdkst|d jdks
tt|j}t|dks&t|d jdks:t|d jdksNtdS )z Ensure that as_doc does not result in out-of-bound access of tokens.
    This is achieved by setting the head to itself if it would lie out of the span otherwise.r      r   r!   r   r   r   r#   r   r   r      ZTheyr"   zjests at scars .z
They neverN)	r%   r&   r'   r(   r   r)   r+   r,   r*   )r1   r-   r.   r/   r,   r   r   r   test_issue3962_longY   s(    
r4   )

__future__r   Zpytestutilr   Zfixturer   r0   r1   r4   r   r   r   r   <module>   s   &