
    NgI                     X    d Z ddlZddlZddlmZ ddlmZ  G d dej                  ZdS )z.
Tests for NIST translation evaluation metric
    N)find)corpus_nistc                       e Zd Zd ZdS )TestNISTc                    t          d          }t          d          }t          d          }t          |          5 }t          t          |                                d                                         dd                   }d d d            n# 1 swxY w Y   t          |d          5 }t          |d          5 }t          t          d	 |                    }t          t          d
 |                    }	t          t          dd          |          D ].\  }
}t          |	||
          }t          ||z
            dk     sJ /	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nzmodels/wmt15_eval/ref.ruzmodels/wmt15_eval/google.ruz#models/wmt15_eval/mteval-13a.output   utf8)encodingc                 *    |                                  S Nsplitxs    ^/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/test/unit/translate/test_nist.py<lambda>z-TestNIST.test_sentence_nist.<locals>.<lambda>   s    		     c                 ,    |                                  gS r   r   r   s    r   r   z-TestNIST.test_sentence_nist.<locals>.<lambda>   s     r   
   g?)r   openmapfloat	readlinesr   listzipranger   abs)selfref_filehyp_filemteval_output_file
mteval_finmteval_nist_scoresref_finhyp_fin
hypotheses
referencesimteval_nist	nltk_nists                r   test_sentence_nistzTestNIST.test_sentence_nist   sI   233566!"GHH $%% 	V "%UJ,@,@,B,B2,F,L,L,N,NqQSt,T!U!U	V 	V 	V 	V 	V 	V 	V 	V 	V 	V 	V 	V 	V 	V 	V
 (V,,, 	?h000 
?G "#&9&97"C"CDD
!#&;&;W"E"EFF
&)%2,,8J&K&K ? ?NA{ +J
A F FI{Y677$>>>>>?
? 
? 
? 
? 
? 
? 
? 
? 
? 
? 
? 
? 
? 
? 
?	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?sI   ABBB-E.?B
E
E.E	E.E	E..E25E2N)__name__
__module____qualname__r-    r   r   r   r      s#        ? ? ? ? ?r   r   )	__doc__iounittest	nltk.datar   nltk.translate.nist_scorer   TestCaser   r1   r   r   <module>r8      s~     
			        1 1 1 1 1 1? ? ? ? ?x  ? ? ? ? ?r   