
    g
                     B    d dl Z d dlmZ  G d de j                        Zy)    N)AnnotationTaskc                   .    e Zd ZdZd Zd Zd Zd Zd Zy)TestDisagreementzN
    Class containing unit tests for nltk.metrics.agreement.Disagreement.
    c                 b    g d}t        |      }| j                  |j                         d       y)z}
        Simple test, based on
        https://github.com/foolswood/krippendorffs_alpha/raw/master/krippendorff.pdf.
        )coder1dress1YEScoder2r	   NOcoder3r	   r   r   dress2r
   r   r   r   )r   dress3r   燼1UUտNr   assertAlmostEqualalphaselfdataannotation_tasks      U/var/www/openai/venv/lib/python3.12/site-packages/nltk/test/unit/test_disagreement.py	test_easyzTestDisagreement.test_easy   s.    

 ).446
C    c                 b    g d}t        |      }| j                  |j                         d       y)z
        Same simple test with 1 rating removed.
        Removal of that rating should not matter: K-Apha ignores items with
        only 1 rating.
        )r   r   r   r   r   r   Nr   r   s      r   
test_easy2zTestDisagreement.test_easy2   s.    
 ).446
Cr   c                     g d}t        |      }| j                  |j                         d       g d}t        |      }| j                  |j                         d       y)zD
        If expected disagreement is 0, K-Apha should be 1.
        )r   1   r   r#   r$   r   2   )r   r'   r(   g      ?)r"   r%   r&   Nr   r   s      r   
test_easy3zTestDisagreement.test_easy3+   sV    
 ).446<K(.446<r   c                 b    g d}t        |      }| j                  |j                         d       y)zw
        More advanced test, based on
        http://www.agreestat.com/research_papers/onkrippendorffalpha.pdf
        ))Ar#   r#   )Br#   r#   )Dr#   r#   )r,   r'   r'   )r-   r'   r'   )Cr'   3)r.   r'   r'   )r,   r0   r0   )r-   r0   r0   )r/   r0   r0   )r.   r0   r0   )r,   4r0   )r-   r1   r0   )r/   r1   r0   )r.   r1   r0   )r,   5r'   )r-   r2   r'   )r/   r2   r'   )r.   r2   r'   )r,   6r#   )r-   r3   r'   )r/   r3   r0   )r.   r3   r1   )r,   7r1   )r-   r4   r1   )r/   r4   r1   )r.   r4   r1   )r,   8r#   )r-   r5   r#   )r/   r5   r'   )r.   r5   r#   )r,   9r'   )r-   r6   r'   )r/   r6   r'   )r.   r6   r'   )r-   10r2   )r/   r7   r2   )r.   r7   r2   )r/   11r#   )r.   r8   r#   )r/   12r0   rˆ?Nr   r   s      r   test_advancedzTestDisagreement.test_advanced<   /    
*
V ).446Gr   c                 b    g d}t        |      }| j                  |j                         d       y)z
        Same more advanced example, but with 1 rating removed.
        Again, removal of that 1 rating should not matter.
        r+   r:   Nr   r   s      r   test_advanced2zTestDisagreement.test_advanced2o   r<   r   N)	__name__
__module____qualname____doc__r   r    r)   r;   r>    r   r   r   r      s%    D D ="1Hf1Hr   r   )unittestnltk.metrics.agreementr   TestCaser   rC   r   r   <module>rG      s!     1ZHx(( ZHr   