o
    i                     @   s>   d dl Z d dlmZ e jdd Zdd Zdd Zd	d
 ZdS )    NDocc                 C   s2   g d}g d}g d}g d}t | ||||dS )N)Pititgengwou   pwoblèmaku   kontwòl)   r      r	      r
   )nsubjROOTamodobjcasenmod)NOUNVERBADJr   ADPr   )wordsheadsdepsposr   )ht_vocabr   r   r   r    r   X/home/ubuntu/.local/lib/python3.10/site-packages/spacy/tests/lang/ht/test_noun_chunks.pydoc   s
   r   c                 C   sB   | d}t t t|j W d   dS 1 sw   Y  dS )zPTest that noun_chunks raises Value Error for 'ht' language if Doc is not parsed.zSa a se yon frazN)pytestraises
ValueErrorlistnoun_chunks)ht_tokenizerr   r   r   r   test_noun_chunks_is_parsed   s   "r#   c                 C   s   i }t | j}t|dksJ |D ]}|D ]}||jd ||j  d7  < qqt|dks1J | D ]\}}|dksIJ |dd | jD fq5dS )z;Test that each token only appears in one noun chunk at mostr   r   c                 S   s   g | ]}|j qS r   )text).0chunkr   r   r   
<listcomp>!   s    z2test_ht_noun_chunks_not_nested.<locals>.<listcomp>N)r    r!   len
setdefaultr$   items)r   r   word_occurredchunksr&   wordfreqr   r   r   test_ht_noun_chunks_not_nested   s   
"r/   c                 C   sz   t | j}| dd }t |j}dt|  k rt|k s"J  J |D ]}||v s,J |jdks3J |jdks:J q$dS )z7Test that the span.noun_chunks property works correctlyr   r
   N)r    r!   r(   startend)r   r"   
doc_chunksspanspan_chunksr&   r   r   r   test_noun_chunks_span$   s   

$r5   )r   spacy.tokensr   fixturer   r#   r/   r5   r   r   r   r   <module>   s    
