a
     ˜ëjo
  ã                   @   sJ   d dl Z d dlmZ d dlmZmZmZ d dlmZ	 dZ
G dd„ dƒZdS )é    N)Úconfig_megam)ÚRTEFeatureExtractorÚrte_classifierÚrte_features)ÚrteaŠ  
alwayson        => True
ne_hyp_extra    => 0
ne_overlap      => 1
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 3
word_overlap    => 3

alwayson        => True
ne_hyp_extra    => 0
ne_overlap      => 1
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 2
word_overlap    => 1

alwayson        => True
ne_hyp_extra    => 1
ne_overlap      => 1
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 1
word_overlap    => 2

alwayson        => True
ne_hyp_extra    => 1
ne_overlap      => 0
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 6
word_overlap    => 2

alwayson        => True
ne_hyp_extra    => 1
ne_overlap      => 0
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 4
word_overlap    => 0

alwayson        => True
ne_hyp_extra    => 1
ne_overlap      => 0
neg_hyp         => 0
neg_txt         => 0
word_hyp_extra  => 3
word_overlap    => 1
c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚTestRTEClassifierc                 C   sN   t  dg¡d d… }dd„ |D ƒ}t ¡  d¡}ttd |ƒƒ}||ksJJ ‚d S )Nzrte1_dev.xmlé   c                 S   s6   g | ].}t t|ƒƒD ]}|d ›dt|ƒ| › �‘qqS )z<15z => )Úsortedr   )Ú.0ÚpairÚkey© r   ú_/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/nltk/test/unit/test_rte_classify.pyÚ
<listcomp>>   s   þzATestRTEClassifier.test_rte_feature_extraction.<locals>.<listcomp>Ú
)Ú
rte_corpusÚpairsÚ#expected_from_rte_feature_extrationÚstripÚsplitÚlistÚfilter)Úselfr   Ztest_outputZexpected_outputr   r   r   Útest_rte_feature_extraction<   s    þz-TestRTEClassifier.test_rte_feature_extractionc                 C   sj   t  dg¡d }t|ƒ}|jh d£ks*J ‚| d¡tƒ ks>J ‚| d¡dhksRJ ‚| d¡dhksfJ ‚d S )Nzrte3_dev.xmlé!   >   ÚmemberÚChinazSCO.ÚwordÚner   r   )r   r   r   Z	hyp_wordsÚoverlapÚsetZ	hyp_extra)r   ZrtepairZ	extractorr   r   r   Útest_feature_extractor_objectI   s    z/TestRTEClassifier.test_feature_extractor_objectc                 C   s   t ddd�}t ddd�}d S )NZIISéd   ©Zsample_NZGIS)r   )r   Úclfr   r   r   Ú%test_rte_classification_without_megamS   s    z7TestRTEClassifier.test_rte_classification_without_megamc              
   C   sN   z
t ƒ  W n2 ttfy< } zt d¡ W Y d }~n
d }~0 0 tddd�}d S )Nz)Skipping tests with dependencies on MEGAMZmegamr"   r#   )r   ÚLookupErrorÚAttributeErrorÚpytestÚskipr   )r   Úer$   r   r   r   Ú"test_rte_classification_with_megamY   s
    
 z4TestRTEClassifier.test_rte_classification_with_megamN)Ú__name__Ú
__module__Ú__qualname__r   r!   r%   r+   r   r   r   r   r   :   s   
r   )r(   Znltkr   Znltk.classify.rte_classifyr   r   r   Znltk.corpusr   r   r   r   r   r   r   r   Ú<module>   s
   3