B
    P?ð[÷  ã               @   s   d dl mZ dd„ ZdS )é    )Úprint_functionc          
   C   sØ   ddd  d¡df }|g}x¸t| |ƒD ]ª\}}x t|ƒD ]”\}\}}|| d }	||	kr8d dd	„ |d
|… D ƒ¡}
d dd	„ ||d d
… D ƒ¡}d||	|f }| d|
dd
… |  d¡|d
d… f ¡ q8W q&W |S )a  
    Returns a list of human-readable strings indicating the errors in the
    given tagging of the corpus.

    :param train_sents: The correct tagging of the corpus
    :type train_sents: list(tuple)
    :param test_sents: The tagged corpus
    :type test_sents: list(tuple)
    z]%25s | %s | %s
--------------------------+------------------------+--------------------------zleft contextzword/test->goldé   zright contexté   ú c             s   s   | ]}d | V  qdS )z%s/%sN© )Ú.0Úwr   r   ú5lib/python3.7/site-packages/nltk/tbl/erroranalysis.pyú	<genexpr>%   s    zerror_list.<locals>.<genexpr>Nc             s   s   | ]}d | V  qdS )z%s/%sNr   )r   r   r   r   r	   r
   &   s    z	%s/%s->%sz%25s | %s | %siçÿÿÿé   )ÚcenterÚzipÚ	enumerateÚjoinÚappend)Ztrain_sentsZ
test_sentsZhdrÚerrorsZ
train_sentZ	test_sentZwordnumZwordZ	train_posZtest_posÚleftÚrightZmidr   r   r	   Ú
error_list   s    
 .r   N)Z
__future__r   r   r   r   r   r	   Ú<module>   s   