ó <¿CVc@s?dZddlZddlmZdejfd„ƒYZdS(s. Tests for BLEU translation evaluation metric iÿÿÿÿN(t_modified_precisiontTestBLEUcBseZd„Zd„ZRS(c CsSdjƒ}djƒ}djƒ}||g}t||ddƒ}t|dƒdks`t‚t||ddƒd kst‚td ƒjƒ}td ƒjƒ}td ƒjƒ}d jƒ}|||g}t||ddƒdksót‚t||ddƒdkst‚tdƒjƒ}tdƒjƒ}|||g}t||ddƒ}t||ddƒ}|dksƒt‚|dks•t‚t|dƒdks°t‚t|dƒdksËt‚t||ddƒ} t||ddƒ} | dkst‚| dkst‚t| dƒdks4t‚t| dƒdksOt‚dS(sm Examples from the original BLEU paper http://www.aclweb.org/anthology/P02-1040.pdf sthe cat is on the matsthere is a cat on the matsthe the the the the the thetniig›æ§èHÒ?igsWIt is a guide to action that ensures that the military will forever heed Party commandsslIt is the guiding principle which guarantees the military forces always being under the command of the PartysQIt is the practical guide for the army always to heed the directions of the partysof thegð?s^It is a guide to action which ensures that the military always obeys the commands of the partysSIt is to insure the troops forever hearing the activity guidebook that party directgŽã8Žã8î?g’$I’$Iâ?gñôJY†8î?g›æ§èHâ?gÓÒÒÒÒÒâ?g;±;±³?gû:pΈÒâ?grùé·¯³?N(tsplitRtroundtAssertionErrortstr( tselftref1tref2thyp1t referencesthyp1_unigram_precisiontref3thyp2thyp2_unigram_precisionthyp1_bigram_precisionthyp2_bigram_precision((st/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/test/unit/translate/test_bleu.pyttest__modified_precision s:    ! !!cCsdS(N((R((st/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/test/unit/translate/test_bleu.pyttest_brevity_penaltyOs(t__name__t __module__RR(((st/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/test/unit/translate/test_bleu.pyR s E(t__doc__tunittesttnltk.translate.bleu_scoreRtTestCaseR(((st/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/test/unit/translate/test_bleu.pyts