forked from mjpost/sacrebleu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sacrebleu.py
executable file
·1353 lines (1186 loc) · 76.8 KB
/
sacrebleu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017--2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
"""
SacreBLEU provides hassle-free computation of shareable, comparable, and reproducible BLEU scores.
Inspired by Rico Sennrich's `multi-bleu-detok.perl`, it produces the official WMT scores but works with plain text.
It also knows all the standard test sets and handles downloading, processing, and tokenization for you.
See the [README.md] file for more information.
"""
from __future__ import print_function
import argparse
import gzip
import logging
import io
import os
import re
import sys
from urllib2 import Request
from collections import Counter, namedtuple
from itertools import izip_longest
from typing import List, Iterable, Tuple
import math
import unicodedata
VERSION = '1.2.10'
try:
# SIGPIPE is not available on Windows machines, throwing an exception.
from signal import SIGPIPE
# If SIGPIPE is available, change behaviour to default instead of ignore.
from signal import signal, SIG_DFL
signal(SIGPIPE, SIG_DFL)
except ImportError:
logging.warning('Could not import signal.SIGPIPE (this is expected on Windows machines)')
# Where to store downloaded test sets.
# Define the environment variable $SACREBLEU, or use the default of ~/.sacrebleu.
#
# Querying for a HOME environment variable can result in None (e.g., on Windows)
# in which case the os.path.join() throws a TypeError. Using expanduser() is
# a safe way to get the user's home folder.
USERHOME = os.path.expanduser("~")
SACREBLEU = os.environ.get('SACREBLEU', os.path.join(USERHOME, '.sacrebleu'))
# n-gram order. Don't change this.
NGRAM_ORDER = 4
# Default values for CHRF
CHRF_ORDER = 6
# default to 2 (per http://www.aclweb.org/anthology/W16-2341)
CHRF_BETA = 2
# This defines data locations.
# At the top level are test sets.
# Beneath each test set, we define the location to download the test data.
# The other keys are each language pair contained in the tarball, and the respective locations of the source and reference data within each.
# Many of these are *.sgm files, which are processed to produced plain text that can be used by this script.
# The canonical location of unpacked, processed data is $SACREBLEU/$TEST/$SOURCE-$TARGET.{$SOURCE,$TARGET}
DATASETS = {
'wmt18': {
'data': ['http://data.statmt.org/wmt18/translation-task/test.tgz'],
'description': 'Official evaluation data.',
'cs-en': ['test/newstest2018-csen-src.cs.sgm', 'test/newstest2018-csen-ref.en.sgm'],
'de-en': ['test/newstest2018-deen-src.de.sgm', 'test/newstest2018-deen-ref.en.sgm'],
'en-cs': ['test/newstest2018-encs-src.en.sgm', 'test/newstest2018-encs-ref.cs.sgm'],
'en-de': ['test/newstest2018-ende-src.en.sgm', 'test/newstest2018-ende-ref.de.sgm'],
'en-et': ['test/newstest2018-enet-src.en.sgm', 'test/newstest2018-enet-ref.et.sgm'],
'en-fi': ['test/newstest2018-enfi-src.en.sgm', 'test/newstest2018-enfi-ref.fi.sgm'],
'en-ru': ['test/newstest2018-enru-src.en.sgm', 'test/newstest2018-enru-ref.ru.sgm'],
'et-en': ['test/newstest2018-eten-src.et.sgm', 'test/newstest2018-eten-ref.en.sgm'],
'fi-en': ['test/newstest2018-fien-src.fi.sgm', 'test/newstest2018-fien-ref.en.sgm'],
'ru-en': ['test/newstest2018-ruen-src.ru.sgm', 'test/newstest2018-ruen-ref.en.sgm'],
'en-tr': ['test/newstest2018-entr-src.en.sgm', 'test/newstest2018-entr-ref.tr.sgm'],
'tr-en': ['test/newstest2018-tren-src.tr.sgm', 'test/newstest2018-tren-ref.en.sgm'],
'en-zh': ['test/newstest2018-enzh-src.en.sgm', 'test/newstest2018-enzh-ref.zh.sgm'],
'zh-en': ['test/newstest2018-zhen-src.zh.sgm', 'test/newstest2018-zhen-ref.en.sgm'],
},
'wmt18/test-ts': {
'data': ['http://data.statmt.org/wmt18/translation-task/test-ts.tgz'],
'description': 'Official evaluation sources with extra test sets interleaved.',
'cs-en': ['test/newstest2018-csen-src-ts.cs.sgm'],
'de-en': ['test/newstest2018-deen-src-ts.de.sgm'],
'en-cs': ['test/newstest2018-encs-src-ts.en.sgm'],
'en-de': ['test/newstest2018-ende-src-ts.en.sgm'],
'en-et': ['test/newstest2018-enet-src-ts.en.sgm'],
'en-fi': ['test/newstest2018-enfi-src-ts.en.sgm'],
'en-ru': ['test/newstest2018-enru-src-ts.en.sgm'],
'et-en': ['test/newstest2018-eten-src-ts.et.sgm'],
'fi-en': ['test/newstest2018-fien-src-ts.fi.sgm'],
'ru-en': ['test/newstest2018-ruen-src-ts.ru.sgm'],
'en-tr': ['test/newstest2018-entr-src-ts.en.sgm'],
'tr-en': ['test/newstest2018-tren-src-ts.tr.sgm'],
'en-zh': ['test/newstest2018-enzh-src-ts.en.sgm'],
'zh-en': ['test/newstest2018-zhen-src-ts.zh.sgm'],
},
'wmt18/dev': {
'data': ['http://data.statmt.org/wmt18/translation-task/dev.tgz'],
'description': 'Development data (Estonian<>English).',
'et-en': ['dev/newsdev2018-eten-src.et.sgm', 'dev/newsdev2018-eten-ref.en.sgm'],
'en-et': ['dev/newsdev2018-enet-src.en.sgm', 'dev/newsdev2018-enet-ref.et.sgm'],
},
'wmt17': {
'data': ['http://data.statmt.org/wmt17/translation-task/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{bojar-EtAl:2017:WMT1,\n author = {Bojar, Ond\\v{r}ej and Chatterjee, Rajen and Federmann, Christian and Graham, Yvette and Haddow, Barry and Huang, Shujian and Huck, Matthias and Koehn, Philipp and Liu, Qun and Logacheva, Varvara and Monz, Christof and Negri, Matteo and Post, Matt and Rubino, Raphael and Specia, Lucia and Turchi, Marco},\n title = {Findings of the 2017 Conference on Machine Translation (WMT17)},\n booktitle = {Proceedings of the Second Conference on Machine Translation, Volume 2: Shared Task Papers},\n month = {September},\n year = {2017},\n address = {Copenhagen, Denmark},\n publisher = {Association for Computational Linguistics},\n pages = {169--214},\n url = {http://www.aclweb.org/anthology/W17-4717}\n}',
'cs-en': ['test/newstest2017-csen-src.cs.sgm', 'test/newstest2017-csen-ref.en.sgm'],
'de-en': ['test/newstest2017-deen-src.de.sgm', 'test/newstest2017-deen-ref.en.sgm'],
'en-cs': ['test/newstest2017-encs-src.en.sgm', 'test/newstest2017-encs-ref.cs.sgm'],
'en-de': ['test/newstest2017-ende-src.en.sgm', 'test/newstest2017-ende-ref.de.sgm'],
'en-fi': ['test/newstest2017-enfi-src.en.sgm', 'test/newstest2017-enfi-ref.fi.sgm'],
'en-lv': ['test/newstest2017-enlv-src.en.sgm', 'test/newstest2017-enlv-ref.lv.sgm'],
'en-ru': ['test/newstest2017-enru-src.en.sgm', 'test/newstest2017-enru-ref.ru.sgm'],
'en-tr': ['test/newstest2017-entr-src.en.sgm', 'test/newstest2017-entr-ref.tr.sgm'],
'en-zh': ['test/newstest2017-enzh-src.en.sgm', 'test/newstest2017-enzh-ref.zh.sgm'],
'fi-en': ['test/newstest2017-fien-src.fi.sgm', 'test/newstest2017-fien-ref.en.sgm'],
'lv-en': ['test/newstest2017-lven-src.lv.sgm', 'test/newstest2017-lven-ref.en.sgm'],
'ru-en': ['test/newstest2017-ruen-src.ru.sgm', 'test/newstest2017-ruen-ref.en.sgm'],
'tr-en': ['test/newstest2017-tren-src.tr.sgm', 'test/newstest2017-tren-ref.en.sgm'],
'zh-en': ['test/newstest2017-zhen-src.zh.sgm', 'test/newstest2017-zhen-ref.en.sgm'],
},
'wmt17/B': {
'data': ['http://data.statmt.org/wmt17/translation-task/test.tgz'],
'description': 'Additional reference for EN-FI and FI-EN.',
'en-fi': ['test/newstestB2017-enfi-src.en.sgm', 'test/newstestB2017-enfi-ref.fi.sgm'],
},
'wmt17/tworefs': {
'data': ['http://data.statmt.org/wmt17/translation-task/test.tgz'],
'description': 'Systems with two references.',
'en-fi': ['test/newstest2017-enfi-src.en.sgm', 'test/newstest2017-enfi-ref.fi.sgm', 'test/newstestB2017-enfi-ref.fi.sgm'],
},
'wmt17/improved': {
'data': ['http://data.statmt.org/wmt17/translation-task/test-update-1.tgz'],
'description': 'Improved zh-en and en-zh translations.',
'en-zh': ['newstest2017-enzh-src.en.sgm', 'newstest2017-enzh-ref.zh.sgm'],
'zh-en': ['newstest2017-zhen-src.zh.sgm', 'newstest2017-zhen-ref.en.sgm'],
},
'wmt17/dev': {
'data': ['http://data.statmt.org/wmt17/translation-task/dev.tgz'],
'description': 'Development sets released for new languages in 2017.',
'en-lv': ['dev/newsdev2017-enlv-src.en.sgm', 'dev/newsdev2017-enlv-ref.lv.sgm'],
'en-zh': ['dev/newsdev2017-enzh-src.en.sgm', 'dev/newsdev2017-enzh-ref.zh.sgm'],
'lv-en': ['dev/newsdev2017-lven-src.lv.sgm', 'dev/newsdev2017-lven-ref.en.sgm'],
'zh-en': ['dev/newsdev2017-zhen-src.zh.sgm', 'dev/newsdev2017-zhen-ref.en.sgm'],
},
'wmt17/ms': {
'data': ['https://github.com/MicrosoftTranslator/Translator-HumanParityData/archive/master.zip',
'http://data.statmt.org/wmt17/translation-task/test-update-1.tgz'],
'description': 'Additional Chinese-English references from Microsoft Research.',
'citation': '@inproceedings{achieving-human-parity-on-automatic-chinese-to-english-news-translation,\n author = {Hassan Awadalla, Hany and Aue, Anthony and Chen, Chang and Chowdhary, Vishal and Clark, Jonathan and Federmann, Christian and Huang, Xuedong and Junczys-Dowmunt, Marcin and Lewis, Will and Li, Mu and Liu, Shujie and Liu, Tie-Yan and Luo, Renqian and Menezes, Arul and Qin, Tao and Seide, Frank and Tan, Xu and Tian, Fei and Wu, Lijun and Wu, Shuangzhi and Xia, Yingce and Zhang, Dongdong and Zhang, Zhirui and Zhou, Ming},\n title = {Achieving Human Parity on Automatic Chinese to English News Translation},\n booktitle = {},\n year = {2018},\n month = {March},\n abstract = {Machine translation has made rapid advances in recent years. Millions of people are using it today in online translation systems and mobile applications in order to communicate across language barriers. The question naturally arises whether such systems can approach or achieve parity with human translations. In this paper, we first address the problem of how to define and accurately measure human parity in translation. We then describe Microsoft’s machine translation system and measure the quality of its translations on the widely used WMT 2017 news translation task from Chinese to English. We find that our latest neural machine translation system has reached a new state-of-the-art, and that the translation quality is at human parity when compared to professional human translations. We also find that it significantly exceeds the quality of crowd-sourced non-professional translations.},\n publisher = {},\n url = {https://www.microsoft.com/en-us/research/publication/achieving-human-parity-on-automatic-chinese-to-english-news-translation/},\n address = {},\n pages = {},\n journal = {},\n volume = {},\n chapter = {},\n isbn = {},\n}',
'zh-en': ['newstest2017-zhen-src.zh.sgm', 'newstest2017-zhen-ref.en.sgm', 'Translator-HumanParityData-master/Translator-HumanParityData/References/Translator-HumanParityData-Reference-HT.txt', 'Translator-HumanParityData-master/Translator-HumanParityData/References/Translator-HumanParityData-Reference-PE.txt'],
},
'wmt16': {
'data': ['http://data.statmt.org/wmt16/translation-task/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{bojar-EtAl:2016:WMT1,\n author = {Bojar, Ond\\v{r}ej and Chatterjee, Rajen and Federmann, Christian and Graham, Yvette and Haddow, Barry and Huck, Matthias and Jimeno Yepes, Antonio and Koehn, Philipp and Logacheva, Varvara and Monz, Christof and Negri, Matteo and Neveol, Aurelie and Neves, Mariana and Popel, Martin and Post, Matt and Rubino, Raphael and Scarton, Carolina and Specia, Lucia and Turchi, Marco and Verspoor, Karin and Zampieri, Marcos},\n title = {Findings of the 2016 Conference on Machine Translation},\n booktitle = {Proceedings of the First Conference on Machine Translation},\n month = {August},\n year = {2016},\n address = {Berlin, Germany},\n publisher = {Association for Computational Linguistics},\n pages = {131--198},\n url = {http://www.aclweb.org/anthology/W/W16/W16-2301}\n}',
'cs-en': ['test/newstest2016-csen-src.cs.sgm', 'test/newstest2016-csen-ref.en.sgm'],
'de-en': ['test/newstest2016-deen-src.de.sgm', 'test/newstest2016-deen-ref.en.sgm'],
'en-cs': ['test/newstest2016-encs-src.en.sgm', 'test/newstest2016-encs-ref.cs.sgm'],
'en-de': ['test/newstest2016-ende-src.en.sgm', 'test/newstest2016-ende-ref.de.sgm'],
'en-fi': ['test/newstest2016-enfi-src.en.sgm', 'test/newstest2016-enfi-ref.fi.sgm'],
'en-ro': ['test/newstest2016-enro-src.en.sgm', 'test/newstest2016-enro-ref.ro.sgm'],
'en-ru': ['test/newstest2016-enru-src.en.sgm', 'test/newstest2016-enru-ref.ru.sgm'],
'en-tr': ['test/newstest2016-entr-src.en.sgm', 'test/newstest2016-entr-ref.tr.sgm'],
'fi-en': ['test/newstest2016-fien-src.fi.sgm', 'test/newstest2016-fien-ref.en.sgm'],
'ro-en': ['test/newstest2016-roen-src.ro.sgm', 'test/newstest2016-roen-ref.en.sgm'],
'ru-en': ['test/newstest2016-ruen-src.ru.sgm', 'test/newstest2016-ruen-ref.en.sgm'],
'tr-en': ['test/newstest2016-tren-src.tr.sgm', 'test/newstest2016-tren-ref.en.sgm'],
},
'wmt16/B': {
'data': ['http://data.statmt.org/wmt16/translation-task/test.tgz'],
'description': 'Additional reference for EN-FI.',
'en-fi': ['test/newstest2016-enfi-src.en.sgm', 'test/newstestB2016-enfi-ref.fi.sgm'],
},
'wmt16/tworefs': {
'data': ['http://data.statmt.org/wmt16/translation-task/test.tgz'],
'description': 'EN-FI with two references.',
'en-fi': ['test/newstest2016-enfi-src.en.sgm', 'test/newstest2016-enfi-ref.fi.sgm', 'test/newstestB2016-enfi-ref.fi.sgm'],
},
'wmt16/dev': {
'data': ['http://data.statmt.org/wmt16/translation-task/dev.tgz'],
'description': 'Development sets released for new languages in 2016.',
'en-ro': ['dev/newsdev2016-enro-src.en.sgm', 'dev/newsdev2016-enro-ref.ro.sgm'],
'en-tr': ['dev/newsdev2016-entr-src.en.sgm', 'dev/newsdev2016-entr-ref.tr.sgm'],
'ro-en': ['dev/newsdev2016-roen-src.ro.sgm', 'dev/newsdev2016-roen-ref.en.sgm'],
'tr-en': ['dev/newsdev2016-tren-src.tr.sgm', 'dev/newsdev2016-tren-ref.en.sgm']
},
'wmt15': {
'data': ['http://statmt.org/wmt15/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{bojar-EtAl:2015:WMT,\n author = {Bojar, Ond\\v{r}ej and Chatterjee, Rajen and Federmann, Christian and Haddow, Barry and Huck, Matthias and Hokamp, Chris and Koehn, Philipp and Logacheva, Varvara and Monz, Christof and Negri, Matteo and Post, Matt and Scarton, Carolina and Specia, Lucia and Turchi, Marco},\n title = {Findings of the 2015 Workshop on Statistical Machine Translation},\n booktitle = {Proceedings of the Tenth Workshop on Statistical Machine Translation},\n month = {September},\n year = {2015},\n address = {Lisbon, Portugal},\n publisher = {Association for Computational Linguistics},\n pages = {1--46},\n url = {http://aclweb.org/anthology/W15-3001}\n}',
'en-fr': ['test/newsdiscusstest2015-enfr-src.en.sgm', 'test/newsdiscusstest2015-enfr-ref.fr.sgm'],
'fr-en': ['test/newsdiscusstest2015-fren-src.fr.sgm', 'test/newsdiscusstest2015-fren-ref.en.sgm'],
'cs-en': ['test/newstest2015-csen-src.cs.sgm', 'test/newstest2015-csen-ref.en.sgm'],
'de-en': ['test/newstest2015-deen-src.de.sgm', 'test/newstest2015-deen-ref.en.sgm'],
'en-cs': ['test/newstest2015-encs-src.en.sgm', 'test/newstest2015-encs-ref.cs.sgm'],
'en-de': ['test/newstest2015-ende-src.en.sgm', 'test/newstest2015-ende-ref.de.sgm'],
'en-fi': ['test/newstest2015-enfi-src.en.sgm', 'test/newstest2015-enfi-ref.fi.sgm'],
'en-ru': ['test/newstest2015-enru-src.en.sgm', 'test/newstest2015-enru-ref.ru.sgm'],
'fi-en': ['test/newstest2015-fien-src.fi.sgm', 'test/newstest2015-fien-ref.en.sgm'],
'ru-en': ['test/newstest2015-ruen-src.ru.sgm', 'test/newstest2015-ruen-ref.en.sgm']
},
'wmt14': {
'data': ['http://statmt.org/wmt14/test-filtered.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{bojar-EtAl:2014:W14-33,\n author = {Bojar, Ondrej and Buck, Christian and Federmann, Christian and Haddow, Barry and Koehn, Philipp and Leveling, Johannes and Monz, Christof and Pecina, Pavel and Post, Matt and Saint-Amand, Herve and Soricut, Radu and Specia, Lucia and Tamchyna, Ale\\v{s}},\n title = {Findings of the 2014 Workshop on Statistical Machine Translation},\n booktitle = {Proceedings of the Ninth Workshop on Statistical Machine Translation},\n month = {June},\n year = {2014},\n address = {Baltimore, Maryland, USA},\n publisher = {Association for Computational Linguistics},\n pages = {12--58},\n url = {http://www.aclweb.org/anthology/W/W14/W14-3302}\n}',
'cs-en': ['test/newstest2014-csen-src.cs.sgm', 'test/newstest2014-csen-ref.en.sgm'],
'en-cs': ['test/newstest2014-csen-src.en.sgm', 'test/newstest2014-csen-ref.cs.sgm'],
'de-en': ['test/newstest2014-deen-src.de.sgm', 'test/newstest2014-deen-ref.en.sgm'],
'en-de': ['test/newstest2014-deen-src.en.sgm', 'test/newstest2014-deen-ref.de.sgm'],
'en-fr': ['test/newstest2014-fren-src.en.sgm', 'test/newstest2014-fren-ref.fr.sgm'],
'fr-en': ['test/newstest2014-fren-src.fr.sgm', 'test/newstest2014-fren-ref.en.sgm'],
'en-hi': ['test/newstest2014-hien-src.en.sgm', 'test/newstest2014-hien-ref.hi.sgm'],
'hi-en': ['test/newstest2014-hien-src.hi.sgm', 'test/newstest2014-hien-ref.en.sgm'],
'en-ru': ['test/newstest2014-ruen-src.en.sgm', 'test/newstest2014-ruen-ref.ru.sgm'],
'ru-en': ['test/newstest2014-ruen-src.ru.sgm', 'test/newstest2014-ruen-ref.en.sgm']
},
'wmt14/full': {
'data': ['http://statmt.org/wmt14/test-full.tgz'],
'description': 'Evaluation data released after official evaluation for further research.',
'cs-en': ['test-full/newstest2014-csen-src.cs.sgm', 'test-full/newstest2014-csen-ref.en.sgm'],
'en-cs': ['test-full/newstest2014-csen-src.en.sgm', 'test-full/newstest2014-csen-ref.cs.sgm'],
'de-en': ['test-full/newstest2014-deen-src.de.sgm', 'test-full/newstest2014-deen-ref.en.sgm'],
'en-de': ['test-full/newstest2014-deen-src.en.sgm', 'test-full/newstest2014-deen-ref.de.sgm'],
'en-fr': ['test-full/newstest2014-fren-src.en.sgm', 'test-full/newstest2014-fren-ref.fr.sgm'],
'fr-en': ['test-full/newstest2014-fren-src.fr.sgm', 'test-full/newstest2014-fren-ref.en.sgm'],
'en-hi': ['test-full/newstest2014-hien-src.en.sgm', 'test-full/newstest2014-hien-ref.hi.sgm'],
'hi-en': ['test-full/newstest2014-hien-src.hi.sgm', 'test-full/newstest2014-hien-ref.en.sgm'],
'en-ru': ['test-full/newstest2014-ruen-src.en.sgm', 'test-full/newstest2014-ruen-ref.ru.sgm'],
'ru-en': ['test-full/newstest2014-ruen-src.ru.sgm', 'test-full/newstest2014-ruen-ref.en.sgm']
},
'wmt13': {
'data': ['http://statmt.org/wmt13/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{bojar-EtAl:2013:WMT,\n author = {Bojar, Ond\\v{r}ej and Buck, Christian and Callison-Burch, Chris and Federmann, Christian and Haddow, Barry and Koehn, Philipp and Monz, Christof and Post, Matt and Soricut, Radu and Specia, Lucia},\n title = {Findings of the 2013 {Workshop on Statistical Machine Translation}},\n booktitle = {Proceedings of the Eighth Workshop on Statistical Machine Translation},\n month = {August},\n year = {2013},\n address = {Sofia, Bulgaria},\n publisher = {Association for Computational Linguistics},\n pages = {1--44},\n url = {http://www.aclweb.org/anthology/W13-2201}\n}',
'cs-en': ['test/newstest2013-src.cs.sgm', 'test/newstest2013-src.en.sgm'],
'en-cs': ['test/newstest2013-src.en.sgm', 'test/newstest2013-src.cs.sgm'],
'de-en': ['test/newstest2013-src.de.sgm', 'test/newstest2013-src.en.sgm'],
'en-de': ['test/newstest2013-src.en.sgm', 'test/newstest2013-src.de.sgm'],
'es-en': ['test/newstest2013-src.es.sgm', 'test/newstest2013-src.en.sgm'],
'en-es': ['test/newstest2013-src.en.sgm', 'test/newstest2013-src.es.sgm'],
'fr-en': ['test/newstest2013-src.fr.sgm', 'test/newstest2013-src.en.sgm'],
'en-fr': ['test/newstest2013-src.en.sgm', 'test/newstest2013-src.fr.sgm'],
'ru-en': ['test/newstest2013-src.ru.sgm', 'test/newstest2013-src.en.sgm'],
'en-ru': ['test/newstest2013-src.en.sgm', 'test/newstest2013-src.ru.sgm']
},
'wmt12': {
'data': ['http://statmt.org/wmt12/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{callisonburch-EtAl:2012:WMT,\n author = {Callison-Burch, Chris and Koehn, Philipp and Monz, Christof and Post, Matt and Soricut, Radu and Specia, Lucia},\n title = {Findings of the 2012 Workshop on Statistical Machine Translation},\n booktitle = {Proceedings of the Seventh Workshop on Statistical Machine Translation},\n month = {June},\n year = {2012},\n address = {Montr{\'e}al, Canada},\n publisher = {Association for Computational Linguistics},\n pages = {10--51},\n url = {http://www.aclweb.org/anthology/W12-3102}\n}',
'cs-en': ['test/newstest2012-src.cs.sgm', 'test/newstest2012-src.en.sgm'],
'en-cs': ['test/newstest2012-src.en.sgm', 'test/newstest2012-src.cs.sgm'],
'de-en': ['test/newstest2012-src.de.sgm', 'test/newstest2012-src.en.sgm'],
'en-de': ['test/newstest2012-src.en.sgm', 'test/newstest2012-src.de.sgm'],
'es-en': ['test/newstest2012-src.es.sgm', 'test/newstest2012-src.en.sgm'],
'en-es': ['test/newstest2012-src.en.sgm', 'test/newstest2012-src.es.sgm'],
'fr-en': ['test/newstest2012-src.fr.sgm', 'test/newstest2012-src.en.sgm'],
'en-fr': ['test/newstest2012-src.en.sgm', 'test/newstest2012-src.fr.sgm']
},
'wmt11': {
'data': ['http://statmt.org/wmt11/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{callisonburch-EtAl:2011:WMT,\n author = {Callison-Burch, Chris and Koehn, Philipp and Monz, Christof and Zaidan, Omar},\n title = {Findings of the 2011 Workshop on Statistical Machine Translation},\n booktitle = {Proceedings of the Sixth Workshop on Statistical Machine Translation},\n month = {July},\n year = {2011},\n address = {Edinburgh, Scotland},\n publisher = {Association for Computational Linguistics},\n pages = {22--64},\n url = {http://www.aclweb.org/anthology/W11-2103}\n}',
'cs-en': ['newstest2011-src.cs.sgm', 'newstest2011-src.en.sgm'],
'en-cs': ['newstest2011-src.en.sgm', 'newstest2011-src.cs.sgm'],
'de-en': ['newstest2011-src.de.sgm', 'newstest2011-src.en.sgm'],
'en-de': ['newstest2011-src.en.sgm', 'newstest2011-src.de.sgm'],
'fr-en': ['newstest2011-src.fr.sgm', 'newstest2011-src.en.sgm'],
'en-fr': ['newstest2011-src.en.sgm', 'newstest2011-src.fr.sgm'],
'es-en': ['newstest2011-src.es.sgm', 'newstest2011-src.en.sgm'],
'en-es': ['newstest2011-src.en.sgm', 'newstest2011-src.es.sgm']
},
'wmt10': {
'data': ['http://statmt.org/wmt10/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{callisonburch-EtAl:2010:WMT,\n author = {Callison-Burch, Chris and Koehn, Philipp and Monz, Christof and Peterson, Kay and Przybocki, Mark and Zaidan, Omar},\n title = {Findings of the 2010 Joint Workshop on Statistical Machine Translation and Metrics for Machine Translation},\n booktitle = {Proceedings of the Joint Fifth Workshop on Statistical Machine Translation and MetricsMATR},\n month = {July},\n year = {2010},\n address = {Uppsala, Sweden},\n publisher = {Association for Computational Linguistics},\n pages = {17--53},\n note = {Revised August 2010},\n url = {http://www.aclweb.org/anthology/W10-1703}\n}',
'cs-en': ['test/newstest2010-src.cz.sgm', 'test/newstest2010-src.en.sgm'],
'en-cs': ['test/newstest2010-src.en.sgm', 'test/newstest2010-src.cz.sgm'],
'de-en': ['test/newstest2010-src.de.sgm', 'test/newstest2010-src.en.sgm'],
'en-de': ['test/newstest2010-src.en.sgm', 'test/newstest2010-src.de.sgm'],
'es-en': ['test/newstest2010-src.es.sgm', 'test/newstest2010-src.en.sgm'],
'en-es': ['test/newstest2010-src.en.sgm', 'test/newstest2010-src.es.sgm'],
'fr-en': ['test/newstest2010-src.fr.sgm', 'test/newstest2010-src.en.sgm'],
'en-fr': ['test/newstest2010-src.en.sgm', 'test/newstest2010-src.fr.sgm']
},
'wmt09': {
'data': ['http://statmt.org/wmt09/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{callisonburch-EtAl:2009:WMT-09,\n author = {Callison-Burch, Chris and Koehn, Philipp and Monz, Christof and Schroeder, Josh},\n title = {Findings of the 2009 {W}orkshop on {S}tatistical {M}achine {T}ranslation},\n booktitle = {Proceedings of the Fourth Workshop on Statistical Machine Translation},\n month = {March},\n year = {2009},\n address = {Athens, Greece},\n publisher = {Association for Computational Linguistics},\n pages = {1--28},\n url = {http://www.aclweb.org/anthology/W/W09/W09-0401}\n}',
'cs-en': ['test/newstest2009-src.cz.sgm', 'test/newstest2009-src.en.sgm'],
'en-cs': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.cz.sgm'],
'de-en': ['test/newstest2009-src.de.sgm', 'test/newstest2009-src.en.sgm'],
'en-de': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.de.sgm'],
'es-en': ['test/newstest2009-src.es.sgm', 'test/newstest2009-src.en.sgm'],
'en-es': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.es.sgm'],
'fr-en': ['test/newstest2009-src.fr.sgm', 'test/newstest2009-src.en.sgm'],
'en-fr': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.fr.sgm'],
'hu-en': ['test/newstest2009-src.hu.sgm', 'test/newstest2009-src.en.sgm'],
'en-hu': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.hu.sgm'],
'it-en': ['test/newstest2009-src.it.sgm', 'test/newstest2009-src.en.sgm'],
'en-it': ['test/newstest2009-src.en.sgm', 'test/newstest2009-src.it.sgm']
},
'wmt08': {
'data': ['http://statmt.org/wmt08/test.tgz'],
'description': 'Official evaluation data.',
'citation': '@InProceedings{callisonburch-EtAl:2008:WMT,\n author = {Callison-Burch, Chris and Fordyce, Cameron and Koehn, Philipp and Monz, Christof and Schroeder, Josh},\n title = {Further Meta-Evaluation of Machine Translation},\n booktitle = {Proceedings of the Third Workshop on Statistical Machine Translation},\n month = {June},\n year = {2008},\n address = {Columbus, Ohio},\n publisher = {Association for Computational Linguistics},\n pages = {70--106},\n url = {http://www.aclweb.org/anthology/W/W08/W08-0309}\n}',
'cs-en': ['test/newstest2008-src.cz.sgm', 'test/newstest2008-src.en.sgm'],
'en-cs': ['test/newstest2008-src.en.sgm', 'test/newstest2008-src.cz.sgm'],
'de-en': ['test/newstest2008-src.de.sgm', 'test/newstest2008-src.en.sgm'],
'en-de': ['test/newstest2008-src.en.sgm', 'test/newstest2008-src.de.sgm'],
'es-en': ['test/newstest2008-src.es.sgm', 'test/newstest2008-src.en.sgm'],
'en-es': ['test/newstest2008-src.en.sgm', 'test/newstest2008-src.es.sgm'],
'fr-en': ['test/newstest2008-src.fr.sgm', 'test/newstest2008-src.en.sgm'],
'en-fr': ['test/newstest2008-src.en.sgm', 'test/newstest2008-src.fr.sgm'],
'hu-en': ['test/newstest2008-src.hu.sgm', 'test/newstest2008-src.en.sgm'],
'en-hu': ['test/newstest2008-src.en.sgm', 'test/newstest2008-src.hu.sgm']
},
'wmt08/nc': {
'data': ['http://statmt.org/wmt08/test.tgz'],
'description': 'Official evaluation data (news commentary).',
'cs-en': ['test/nc-test2008-src.cz.sgm', 'test/nc-test2008-src.en.sgm'],
'en-cs': ['test/nc-test2008-src.en.sgm', 'test/nc-test2008-src.cz.sgm']
},
'wmt08/europarl': {
'data': ['http://statmt.org/wmt08/test.tgz'],
'description': 'Official evaluation data (Europarl).',
'de-en': ['test/test2008-src.de.sgm', 'test/test2008-src.en.sgm'],
'en-de': ['test/test2008-src.en.sgm', 'test/test2008-src.de.sgm'],
'es-en': ['test/test2008-src.es.sgm', 'test/test2008-src.en.sgm'],
'en-es': ['test/test2008-src.en.sgm', 'test/test2008-src.es.sgm'],
'fr-en': ['test/test2008-src.fr.sgm', 'test/test2008-src.en.sgm'],
'en-fr': ['test/test2008-src.en.sgm', 'test/test2008-src.fr.sgm']
},
'iwslt17': {
'data': ['https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/ar/en-ar.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/ar/en/ar-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/ja/en-ja.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/ja/en/ja-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/ko/en-ko.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/ko/en/ko-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/zh/en/zh-en.tgz'],
'description': 'Official evaluation data for IWSLT.',
'citation': '@InProceedings{iwslt2017,\n author = {Cettolo, Mauro and Federico, Marcello and Bentivogli, Luisa and Niehues, Jan and Stüker, Sebastian and Sudoh, Katsuitho and Yoshino, Koichiro and Federmann, Christian},\n title = {Overview of the IWSLT 2017 Evaluation Campaign},\n booktitle = {14th International Workshop on Spoken Language Translation},\n month = {December},\n year = {2017},\n address = {Tokyo, Japan},\n pages = {2--14},\n url = {http://workshop2017.iwslt.org/downloads/iwslt2017_proceeding_v2.pdf}\n}',
'en-fr': ['en-fr/IWSLT17.TED.tst2017.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2017.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2017.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2017.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2017.en-de.en.xml', 'de-en/IWSLT17.TED.tst2017.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2017.de-en.de.xml', 'en-de/IWSLT17.TED.tst2017.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2017.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2017.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2017.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2017.en-zh.en.xml'],
},
'iwslt17/tst2016': {
'data': ['https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-ted-test/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2016.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2016.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2016.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2016.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2016.en-de.en.xml', 'de-en/IWSLT17.TED.tst2016.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2016.de-en.de.xml', 'en-de/IWSLT17.TED.tst2016.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2016.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2016.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2016.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2016.en-zh.en.xml'],
},
'iwslt17/tst2015': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2015.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2015.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2015.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2015.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2015.en-de.en.xml', 'de-en/IWSLT17.TED.tst2015.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2015.de-en.de.xml', 'en-de/IWSLT17.TED.tst2015.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2015.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2015.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2015.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2015.en-zh.en.xml'],
},
'iwslt17/tst2014': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2014.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2014.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2014.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2014.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2014.en-de.en.xml', 'de-en/IWSLT17.TED.tst2014.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2014.de-en.de.xml', 'en-de/IWSLT17.TED.tst2014.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2014.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2014.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2014.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2014.en-zh.en.xml'],
},
'iwslt17/tst2013': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2013.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2013.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2013.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2013.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2013.en-de.en.xml', 'de-en/IWSLT17.TED.tst2013.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2013.de-en.de.xml', 'en-de/IWSLT17.TED.tst2013.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2013.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2013.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2013.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2013.en-zh.en.xml'],
},
'iwslt17/tst2012': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2012.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2012.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2012.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2012.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2012.en-de.en.xml', 'de-en/IWSLT17.TED.tst2012.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2012.de-en.de.xml', 'en-de/IWSLT17.TED.tst2012.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2012.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2012.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2012.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2012.en-zh.en.xml'],
},
'iwslt17/tst2011': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2011.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2011.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2011.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2011.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2011.en-de.en.xml', 'de-en/IWSLT17.TED.tst2011.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2011.de-en.de.xml', 'en-de/IWSLT17.TED.tst2011.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2011.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2011.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2011.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2011.en-zh.en.xml'],
},
'iwslt17/tst2010': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.tst2010.en-fr.en.xml', 'fr-en/IWSLT17.TED.tst2010.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.tst2010.fr-en.fr.xml', 'en-fr/IWSLT17.TED.tst2010.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.tst2010.en-de.en.xml', 'de-en/IWSLT17.TED.tst2010.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.tst2010.de-en.de.xml', 'en-de/IWSLT17.TED.tst2010.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.tst2010.en-zh.en.xml', 'zh-en/IWSLT17.TED.tst2010.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.tst2010.zh-en.zh.xml', 'en-zh/IWSLT17.TED.tst2010.en-zh.en.xml'],
},
'iwslt17/dev2010': {
'data': ['https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/de/en-de.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/de/en/de-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/fr/en-fr.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/fr/en/fr-en.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/en/zh/en-zh.tgz',
'https://wit3.fbk.eu/archive/2017-01-trnted/texts/zh/en/zh-en.tgz'],
'description': 'Development data for IWSLT 2017.',
'en-fr': ['en-fr/IWSLT17.TED.dev2010.en-fr.en.xml', 'fr-en/IWSLT17.TED.dev2010.fr-en.fr.xml'],
'fr-en': ['fr-en/IWSLT17.TED.dev2010.fr-en.fr.xml', 'en-fr/IWSLT17.TED.dev2010.en-fr.en.xml'],
'en-de': ['en-de/IWSLT17.TED.dev2010.en-de.en.xml', 'de-en/IWSLT17.TED.dev2010.de-en.de.xml'],
'de-en': ['de-en/IWSLT17.TED.dev2010.de-en.de.xml', 'en-de/IWSLT17.TED.dev2010.en-de.en.xml'],
'en-zh': ['en-zh/IWSLT17.TED.dev2010.en-zh.en.xml', 'zh-en/IWSLT17.TED.dev2010.zh-en.zh.xml'],
'zh-en': ['zh-en/IWSLT17.TED.dev2010.zh-en.zh.xml', 'en-zh/IWSLT17.TED.dev2010.en-zh.en.xml'],
},
}
def tokenize_13a(line):
"""
Tokenizes an input line using a relatively minimal tokenization that is however equivalent to mteval-v13a, used by WMT.
:param line: a segment to tokenize
:return: the tokenized line
"""
norm = line
# language-independent part:
norm = norm.replace('<skipped>', '')
norm = norm.replace('-\n', '')
norm = norm.replace('\n', ' ')
norm = norm.replace('"', '"')
norm = norm.replace('&', '&')
norm = norm.replace('<', '<')
norm = norm.replace('>', '>')
# language-dependent part (assuming Western languages):
norm = " {} ".format(norm)
norm = re.sub(r'([\{-\~\[-\` -\&\(-\+\:-\@\/])', ' \\1 ', norm)
norm = re.sub(r'([^0-9])([\.,])', '\\1 \\2 ', norm) # tokenize period and comma unless preceded by a digit
norm = re.sub(r'([\.,])([^0-9])', ' \\1 \\2', norm) # tokenize period and comma unless followed by a digit
norm = re.sub(r'([0-9])(-)', '\\1 \\2 ', norm) # tokenize dash when preceded by a digit
norm = re.sub(r'\s+', ' ', norm) # one space only between words
norm = re.sub(r'^\s+', '', norm) # no leading space
norm = re.sub(r'\s+$', '', norm) # no trailing space
return norm
class UnicodeRegex:
"""Ad-hoc hack to recognize all punctuation and symbols.
without dependening on https://pypi.python.org/pypi/regex/."""
def _property_chars(prefix):
return ''.join(unicode(chr(x)) for x in range(sys.maxunicode)
if unicodedata.category(unicode(chr(x))).startswith(prefix))
punctuation = _property_chars('P')
nondigit_punct_re = re.compile(r'([^\d])([' + punctuation + r'])')
punct_nondigit_re = re.compile(r'([' + punctuation + r'])([^\d])')
symbol_re = re.compile('([' + _property_chars('S') + '])')
def tokenize_v14_international(string):
r"""Tokenize a string following the official BLEU implementation.
See https://github.com/moses-smt/mosesdecoder/blob/master/scripts/generic/mteval-v14.pl#L954-L983
In our case, the input string is expected to be just one line
and no HTML entities de-escaping is needed.
So we just tokenize on punctuation and symbols,
except when a punctuation is preceded and followed by a digit
(e.g. a comma/dot as a thousand/decimal separator).
Note that a number (e.g., a year) followed by a dot at the end of sentence is NOT tokenized,
i.e. the dot stays with the number because `s/(\p{P})(\P{N})/ $1 $2/g`
does not match this case (unless we add a space after each sentence).
However, this error is already in the original mteval-v14.pl
and we want to be consistent with it.
The error is not present in the non-international version,
which uses `$norm_text = " $norm_text "` (or `norm = " {} ".format(norm)` in Python).
:param string: the input string
:return: a list of tokens
"""
string = UnicodeRegex.nondigit_punct_re.sub(r'\1 \2 ', string)
string = UnicodeRegex.punct_nondigit_re.sub(r' \1 \2', string)
string = UnicodeRegex.symbol_re.sub(r' \1 ', string)
return string.strip()
def tokenize_zh(sentence):
"""MIT License
Copyright (c) 2017 - Shujian Huang <huangsj@nju.edu.cn>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The tokenization of Chinese text in this script contains two steps: separate each Chinese
characters (by utf-8 encoding); tokenize the non Chinese part (following the mteval script).
Author: Shujian Huang huangsj@nju.edu.cn
:param sentence: input sentence
:return: tokenized sentence
"""
def is_chinese_char(uchar):
"""
:param uchar: input char in unicode
:return: whether the input char is a Chinese character.
"""
if uchar >= u'\u3400' and uchar <= u'\u4db5': # CJK Unified Ideographs Extension A, release 3.0
return True
elif uchar >= u'\u4e00' and uchar <= u'\u9fa5': # CJK Unified Ideographs, release 1.1
return True
elif uchar >= u'\u9fa6' and uchar <= u'\u9fbb': # CJK Unified Ideographs, release 4.1
return True
elif uchar >= u'\uf900' and uchar <= u'\ufa2d': # CJK Compatibility Ideographs, release 1.1
return True
elif uchar >= u'\ufa30' and uchar <= u'\ufa6a': # CJK Compatibility Ideographs, release 3.2
return True
elif uchar >= u'\ufa70' and uchar <= u'\ufad9': # CJK Compatibility Ideographs, release 4.1
return True
elif uchar >= u'\u20000' and uchar <= u'\u2a6d6': # CJK Unified Ideographs Extension B, release 3.1
return True
elif uchar >= u'\u2f800' and uchar <= u'\u2fa1d': # CJK Compatibility Supplement, release 3.1
return True
elif uchar >= u'\uff00' and uchar <= u'\uffef': # Full width ASCII, full width of English punctuation, half width Katakana, half wide half width kana, Korean alphabet
return True
elif uchar >= u'\u2e80' and uchar <= u'\u2eff': # CJK Radicals Supplement
return True
elif uchar >= u'\u3000' and uchar <= u'\u303f': # CJK punctuation mark
return True
elif uchar >= u'\u31c0' and uchar <= u'\u31ef': # CJK stroke
return True
elif uchar >= u'\u2f00' and uchar <= u'\u2fdf': # Kangxi Radicals
return True
elif uchar >= u'\u2ff0' and uchar <= u'\u2fff': # Chinese character structure
return True
elif uchar >= u'\u3100' and uchar <= u'\u312f': # Phonetic symbols
return True
elif uchar >= u'\u31a0' and uchar <= u'\u31bf': # Phonetic symbols (Taiwanese and Hakka expansion)
return True
elif uchar >= u'\ufe10' and uchar <= u'\ufe1f':
return True
elif uchar >= u'\ufe30' and uchar <= u'\ufe4f':
return True
elif uchar >= u'\u2600' and uchar <= u'\u26ff':
return True
elif uchar >= u'\u2700' and uchar <= u'\u27bf':
return True
elif uchar >= u'\u3200' and uchar <= u'\u32ff':
return True
elif uchar >= u'\u3300' and uchar <= u'\u33ff':
return True
return False
sentence = sentence.strip()
sentence_in_chars = ""
for char in sentence:
if is_chinese_char(char):
sentence_in_chars += " "
sentence_in_chars += char
sentence_in_chars += " "
else:
sentence_in_chars += char
sentence = sentence_in_chars
# tokenize punctuation
sentence = re.sub(r'([\{-\~\[-\` -\&\(-\+\:-\@\/])', r' \1 ', sentence)
# tokenize period and comma unless preceded by a digit
sentence = re.sub(r'([^0-9])([\.,])', r'\1 \2 ', sentence)
# tokenize period and comma unless followed by a digit
sentence = re.sub(r'([\.,])([^0-9])', r' \1 \2', sentence)
# tokenize dash when preceded by a digit
sentence = re.sub(r'([0-9])(-)', r'\1 \2 ', sentence)
# one space only between words
sentence = re.sub(r'\s+', r' ', sentence)
# no leading space
sentence = re.sub(r'^\s+', r'', sentence)
# no trailing space
sentence = re.sub(r'\s+$', r'', sentence)
return sentence
TOKENIZERS = {
'13a': tokenize_13a,
'intl': tokenize_v14_international,
'zh': tokenize_zh,
'none': lambda x: x,
}
DEFAULT_TOKENIZER = '13a'
def smart_open(file, mode='rt', encoding='utf-8'):
"""Convenience function for reading compressed or plain text files.
:param file: The file to read.
:param encoding: The file encoding.
"""
if file.endswith('.gz'):
return gzip.open(file, mode=mode, encoding=encoding)
return open(file, mode=mode, encoding=encoding)
def my_log(num):
"""
Floors the log function
:param num: the number
:return: log(num) floored to a very low number
"""
if num == 0.0:
return -9999999999
return math.log(num)
def bleu_signature(args, numrefs):
"""
Builds a signature that uniquely identifies the scoring parameters used.
:param args: the arguments passed into the script
:return: the signature
"""
# Abbreviations for the signature
abbr = {
'test': 't',
'lang': 'l',
'smooth': 's',
'case': 'c',
'tok': 'tok',
'numrefs': '#',
'version': 'v'
}
signature = {'tok': args.tokenize,
'version': VERSION,
'smooth': args.smooth,
'numrefs': numrefs,
'case': 'lc' if args.lc else 'mixed'}
if args.test_set is not None:
signature['test'] = args.test_set
if args.langpair is not None:
signature['lang'] = args.langpair
sigstr = '+'.join(['{}.{}'.format(abbr[x] if args.short else x, signature[x]) for x in sorted(signature.keys())])
return sigstr
def chrf_signature(args, numrefs):
"""
Builds a signature that uniquely identifies the scoring parameters used.
:param args: the arguments passed into the script
:return: the chrF signature
"""
# Abbreviations for the signature
abbr = {
'test': 't',
'lang': 'l',
'numchars': 'n',
'space': 's',
'case': 'c',
'numrefs': '#',
'version': 'v'
}
signature = {'tok': args.tokenize,
'version': VERSION,
'space': args.chrf_whitespace,
'numchars': args.chrf_order,
'numrefs': numrefs,
'case': 'lc' if args.lc else 'mixed'}
if args.test_set is not None:
signature['test'] = args.test_set
if args.langpair is not None:
signature['lang'] = args.langpair
sigstr = '+'.join(['{}.{}'.format(abbr[x] if args.short else x, signature[x]) for x in sorted(signature.keys())])
return sigstr
def extract_ngrams(line, min_order=1, max_order=NGRAM_ORDER):
"""Extracts all the ngrams (1 <= n <= NGRAM_ORDER) from a sequence of tokens.
:param line: a segment containing a sequence of words
:param max_order: collect n-grams from 1<=n<=max
:return: a dictionary containing ngrams and counts
"""
ngrams = Counter()
tokens = line.split()
for n in range(min_order, max_order + 1):
for i in range(0, len(tokens) - n + 1):
ngram = ' '.join(tokens[i: i + n])
ngrams[ngram] += 1
return ngrams
extract_ngrams.__annotations__ = {'return': Counter}
def extract_char_ngrams(s, n):
"""
Yields counts of character n-grams from string s of order n.
"""
return Counter([s[i:i + n] for i in range(len(s) - n + 1)])
extract_char_ngrams.__annotations__ = {'s': str, 'n': int, 'return': Counter}
def ref_stats(output, refs):
ngrams = Counter()
closest_diff = None
closest_len = None
for ref in refs:
tokens = ref.split()
reflen = len(tokens)
diff = abs(len(output.split()) - reflen)
if closest_diff is None or diff < closest_diff:
closest_diff = diff
closest_len = reflen
elif diff == closest_diff:
if reflen < closest_len:
closest_len = reflen
ngrams_ref = extract_ngrams(ref)
for ngram in ngrams_ref.keys():
ngrams[ngram] = max(ngrams[ngram], ngrams_ref[ngram])
return ngrams, closest_diff, closest_len
def _clean(s):
"""
Removes trailing and leading spaces and collapses multiple consecutive internal spaces to a single one.
:param s: The string.
:return: A cleaned-up string.
"""
return re.sub(r'\s+', ' ', s.strip())
def process_to_text(rawfile, txtfile):
"""Processes raw files to plain text files.
:param rawfile: the input file (possibly SGML)
:param txtfile: the plaintext file
"""
if not os.path.exists(txtfile) or os.path.getsize(txtfile) == 0:
logging.info("Processing %s to %s", rawfile, txtfile)
if rawfile.endswith('.sgm') or rawfile.endswith('.sgml'):
with smart_open(rawfile) as fin, smart_open(txtfile, 'wt') as fout:
for line in fin:
if line.startswith('<seg '):
print(_clean(re.sub(r'<seg.*?>(.*)</seg>.*?', '\\1', line)), file=fout)
elif rawfile.endswith('.xml'): # IWSLT
with smart_open(rawfile) as fin, smart_open(txtfile, 'wt') as fout:
for line in fin:
if line.startswith('<seg '):
print(_clean(re.sub(r'<seg.*?>(.*)</seg>.*?', '\\1', line)), file=fout)
elif rawfile.endswith('.txt'): # wmt17/ms
with smart_open(rawfile) as fin, smart_open(txtfile, 'wt') as fout:
for line in fin:
print(line.rstrip(), file=fout)
def print_test_set(test_set, langpair, side):
"""Prints to STDOUT the specified side of the specified test set
:param test_set: the test set to print
:param langpair: the language pair
:param side: 'src' for source, 'ref' for reference
"""
files = download_test_set(test_set, langpair)
if side == 'src':
files = [files[0]]
elif side == 'ref':
files.pop(0)
streams = [smart_open(file) for file in files]
for lines in zip(*streams):
print('\t'.join(map(lambda x: x.rstrip(), lines)))
def download_test_set(test_set, langpair=None):
"""Downloads the specified test to the system location specified by the SACREBLEU environment variable.
:param test_set: the test set to download
:param langpair: the language pair (needed for some datasets)
:return: the set of processed files
"""
outdir = os.path.join(SACREBLEU, test_set)
if not os.path.exists(outdir):
logging.info('Creating %s', outdir)
os.makedirs(outdir)
for dataset in DATASETS[test_set]['data']:
tarball = os.path.join(outdir, os.path.basename(dataset))
rawdir = os.path.join(outdir, 'raw')
if not os.path.exists(tarball) or os.path.getsize(tarball) == 0:
# TODO: check MD5sum
logging.info("Downloading %s to %s", dataset, tarball)
try:
with Request.urlopen(dataset) as f, open(tarball, 'wb') as out:
out.write(f.read())
except ssl.SSLError:
log.warning('An SSL error was encountered in downloading the files. If you\'re on a Mac, '
'you may need to run the "Install Certificates.command" file located in the '
'"Python 3" folder, often found under /Applications')
sys.exit(1)
# Extract the tarball
logging.info('Extracting %s', tarball)
if tarball.endswith('.tar.gz') or tarball.endswith('.tgz'):
import tarfile
tar = tarfile.open(tarball)
tar.extractall(path=rawdir)
elif tarball.endswith('.zip'):
import zipfile
zipfile = zipfile.ZipFile(tarball, 'r')
zipfile.extractall(path=rawdir)
zipfile.close()
found = []
# Process the files into plain text
languages = DATASETS[test_set].keys() if langpair is None else [langpair]
for pair in languages:
if '-' not in pair:
continue
src, tgt = pair.split('-')
rawfile = os.path.join(rawdir, DATASETS[test_set][pair][0])
outfile = os.path.join(outdir, '{}.{}'.format(pair, src))
process_to_text(rawfile, outfile)
found.append(outfile)
for i, ref in enumerate(DATASETS[test_set][pair][1:]):
rawfile = os.path.join(rawdir, ref)
if len(DATASETS[test_set][pair][1:]) >= 2:
outfile = os.path.join(outdir, '{}.{}.{}'.format(pair, tgt, i))
else:
outfile = os.path.join(outdir, '{}.{}'.format(pair, tgt))
process_to_text(rawfile, outfile)
found.append(outfile)
return found
BLEU = namedtuple('BLEU', 'score, counts, totals, precisions, bp, sys_len, ref_len')
def compute_bleu(correct, total, sys_len, ref_len, smooth = 'none', smooth_floor = 0.01,
use_effective_order = False):
"""Computes BLEU score from its sufficient statistics. Adds smoothing.
:param correct: List of counts of correct ngrams, 1 <= n <= NGRAM_ORDER
:param total: List of counts of total ngrams, 1 <= n <= NGRAM_ORDER
:param sys_len: The cumulative system length
:param ref_len: The cumulative reference length
:param smooth: The smoothing method to use
:param smooth_floor: The smoothing value added, if smooth method 'floor' is used
:param use_effective_order: Use effective order.
:return: A BLEU object with the score (100-based) and other statistics.
"""
precisions = [0 for x in range(NGRAM_ORDER)]
smooth_mteval = 1.
effective_order = NGRAM_ORDER
for n in range(NGRAM_ORDER):
if total[n] == 0:
break
if use_effective_order:
effective_order = n + 1
if correct[n] == 0:
if smooth == 'exp':
smooth_mteval *= 2
precisions[n] = 100. / (smooth_mteval * total[n])
elif smooth == 'floor':
precisions[n] = 100. * smooth_floor / total[n]
else:
precisions[n] = 100. * correct[n] / total[n]
# If the system guesses no i-grams, 1 <= i <= NGRAM_ORDER, the BLEU score is 0 (technically undefined).
# This is a problem for sentence-level BLEU or a corpus of short sentences, where systems will get no credit
# if sentence lengths fall under the NGRAM_ORDER threshold. This fix scales NGRAM_ORDER to the observed
# maximum order. It is only available through the API and off by default
brevity_penalty = 1.0
if sys_len < ref_len:
brevity_penalty = math.exp(1 - ref_len / sys_len) if sys_len > 0 else 0.0
bleu = brevity_penalty * math.exp(sum(map(my_log, precisions[:effective_order])) / effective_order)
return BLEU._make([bleu, correct, total, precisions, brevity_penalty, sys_len, ref_len])
compute_bleu.__annotations__ = {'correct': List[int], 'total': List[int], 'sys_len': int, 'ref_len': int, 'return': BLEU}