def load_translation_data(dataset, bleu, args):
src_lang, tgt_lang = args.src_lang, args.tgt_lang<EOL>if dataset == '<STR_LIT>':<EOL><INDENT>common_prefix = '<STR_LIT>'.format(src_lang, tgt_lang,<EOL>args.src_max_len, args.tgt_max_len)<EOL>data_train = nlp.data.IWSLT2015('<STR_LIT:train>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_val = nlp.data.IWSLT2015('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_test = nlp.data.IWSLT2015('<STR_LIT:test>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL><DEDENT>elif dataset == '<STR_LIT>':<EOL><INDENT>common_prefix = '<STR_LIT>'.format(src_lang, tgt_lang,<EOL>args.src_max_len, args.tgt_max_len)<EOL>data_train = nlp.data.WMT2016BPE('<STR_LIT:train>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_val = nlp.data.WMT2016BPE('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_test = nlp.data.WMT2016BPE('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL><DEDENT>elif dataset == '<STR_LIT>':<EOL><INDENT>common_prefix = '<STR_LIT>'.format(src_lang, tgt_lang,<EOL>args.src_max_len, args.tgt_max_len)<EOL>data_train = nlp.data.WMT2014BPE('<STR_LIT:train>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_val = nlp.data.WMT2014BPE('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_test = nlp.data.WMT2014BPE('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang,<EOL>full=args.full)<EOL><DEDENT>elif dataset == '<STR_LIT>':<EOL><INDENT>common_prefix = '<STR_LIT>'.format(src_lang, tgt_lang,<EOL>args.src_max_len, args.tgt_max_len)<EOL>data_train = _dataset.TOY('<STR_LIT:train>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_val = _dataset.TOY('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>data_test = _dataset.TOY('<STR_LIT:test>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>src_vocab, tgt_vocab = data_train.src_vocab, data_train.tgt_vocab<EOL>data_train_processed = _load_cached_dataset(common_prefix + '<STR_LIT>')<EOL>if not data_train_processed:<EOL><INDENT>data_train_processed = process_dataset(data_train, src_vocab, tgt_vocab,<EOL>args.src_max_len, args.tgt_max_len)<EOL>_cache_dataset(data_train_processed, common_prefix + '<STR_LIT>')<EOL><DEDENT>data_val_processed = _load_cached_dataset(common_prefix + '<STR_LIT>')<EOL>if not data_val_processed:<EOL><INDENT>data_val_processed = process_dataset(data_val, src_vocab, tgt_vocab)<EOL>_cache_dataset(data_val_processed, common_prefix + '<STR_LIT>')<EOL><DEDENT>if dataset == '<STR_LIT>':<EOL><INDENT>filename = common_prefix + '<STR_LIT:_>' + str(args.full) + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>filename = common_prefix + '<STR_LIT>'<EOL><DEDENT>data_test_processed = _load_cached_dataset(filename)<EOL>if not data_test_processed:<EOL><INDENT>data_test_processed = process_dataset(data_test, src_vocab, tgt_vocab)<EOL>_cache_dataset(data_test_processed, filename)<EOL><DEDENT>if bleu == '<STR_LIT>':<EOL><INDENT>fetch_tgt_sentence = lambda src, tgt: tgt.split()<EOL>val_tgt_sentences = list(data_val.transform(fetch_tgt_sentence))<EOL>test_tgt_sentences = list(data_test.transform(fetch_tgt_sentence))<EOL><DEDENT>elif bleu == '<STR_LIT>' or bleu == '<STR_LIT>':<EOL><INDENT>fetch_tgt_sentence = lambda src, tgt: tgt<EOL>if dataset == '<STR_LIT>':<EOL><INDENT>val_text = nlp.data.WMT2016('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>test_text = nlp.data.WMT2016('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL><DEDENT>elif dataset == '<STR_LIT>':<EOL><INDENT>val_text = nlp.data.WMT2014('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang)<EOL>test_text = nlp.data.WMT2014('<STR_LIT>', src_lang=src_lang, tgt_lang=tgt_lang,<EOL>full=args.full)<EOL><DEDENT>elif dataset == '<STR_LIT>' or dataset == '<STR_LIT>':<EOL><INDENT>val_text = data_val<EOL>test_text = data_test<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>val_tgt_sentences = list(val_text.transform(fetch_tgt_sentence))<EOL>test_tgt_sentences = list(test_text.transform(fetch_tgt_sentence))<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>return data_train_processed, data_val_processed, data_test_processed,val_tgt_sentences, test_tgt_sentences, src_vocab, tgt_vocab<EOL>
Load translation dataset

    Parameters
    ----------
    dataset : str
    args : argparse result

    Returns
    -------