o
    h                     @   st   d dl Z d dlmZ d dlmZ d dlmZ d dlT e jje jj	gZ
e jdddd	 Zd
d Zdd Zdd ZdS )    N)Pipeline)tree_reader)utils)*module)scopec                   C   s   t tddddS )Nenztokenize, posT)dirlang
processorstokenize_pretokenized)r   TEST_MODELS_DIR r   r   _/var/www/html/env_mimamsha/lib/python3.10/site-packages/stanza/tests/constituency/test_utils.pypipeline   s   r   c                 C   :   d}d}t |}tj|| gdd}|t |ksJ dS )zf
    Test using the English tagger that trees will be correctly retagged by read_trees using xpos
    o((S (VP (X Find)) (NP (X Mox) (X Opal))))   ((S (NP (X Ragavan)) (VP (X steals) (NP (X important) (X cards)))))zy((S (VP (VB Find)) (NP (NNP Mox) (NNP Opal)))) ((S (NP (NNP Ragavan)) (VP (VBZ steals) (NP (JJ important) (NNS cards)))))TxposNr   
read_treesr   retag_treesr   textexpectedtrees	new_treesr   r   r   test_xpos_retag   
   
r   c                 C   r   )zf
    Test using the English tagger that trees will be correctly retagged by read_trees using upos
    r   z((S (VP (VERB Find)) (NP (PROPN Mox) (PROPN Opal)))) ((S (NP (PROPN Ragavan)) (VP (VERB steals) (NP (ADJ important) (NOUN cards)))))Fr   Nr   r   r   r   r   test_upos_retag    r   r   c                  C   s   d} d}t | }g d}|d |}|t |d ksJ tt ddg}|d |}W d   n1 s:w   Y  tt g d}|d |}W d   dS 1 s[w   Y  dS )	zz
    Test the underlying replace_tags method

    Also tests that the method throws exceptions when it is supposed to
    z)((S (VP (X Find)) (NP (X Mox) (X Opal))))z)((S (VP (A Find)) (NP (B Mox) (C Opal)))))ABCr   r    r!   N)r    r!   r"   D)r   r   replace_tagspytestraises
ValueError)r   r   r   new_tagsnew_treer   r   r   test_replace_tags-   s   
"r*   )r%   stanzar   stanza.models.constituencyr   r   stanza.testsmarkr   travis
pytestmarkfixturer   r   r*   r   r   r   r   <module>   s    

