0066f83bc6f9f3861119db2593c3007796d2056c,deeppavlov/metrics/bleu.py,,per_item_dialog_bleu,#Any#Any#,40

Before Change


@register_metric("per_item_dialog_bleu")
def per_item_dialog_bleu(y_true, y_predicted):
    y_true = [y["text"] for dialog in y_true for y in dialog]
    y_predicted = itertools.chain(*y_predicted)
    examples_len = len(y_true)
    bleu_list = (sentence_bleu([y2.lower().split()], y1.lower().split())\
                 for y1, y2 in zip(y_true, y_predicted))
    return sum(bleu_list) / examples_len if examples_len else 0.

After Change



@register_metric("per_item_dialog_bleu")
def per_item_dialog_bleu(y_true, y_predicted):
    y_true = (y["text"] for dialog in y_true for y in dialog)
    return corpus_bleu([[y_t.lower().split()] for y_t in y_true],
                       [y_p.lower().split() for y_p in y_predicted])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 6

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: 0066f83bc6f9f3861119db2593c3007796d2056c
Time: 2018-08-30
Author: mary.vikhreva@gmail.com
File Name: deeppavlov/metrics/bleu.py
Class Name:
Method Name: per_item_dialog_bleu


Project Name: NifTK/NiftyNet
Commit Name: 31fd5e11806c319b493b47fe029a48811445d9e8
Time: 2017-08-24
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/application_driver.py
Class Name: ApplicationDriver
Method Name: _inference_loop


Project Name: deepmipt/DeepPavlov
Commit Name: 0066f83bc6f9f3861119db2593c3007796d2056c
Time: 2018-08-30
Author: mary.vikhreva@gmail.com
File Name: deeppavlov/metrics/bleu.py
Class Name:
Method Name: per_item_bleu


Project Name: deepmipt/DeepPavlov
Commit Name: c15e52623156084fbd74727dd3f34df2825e2ad3
Time: 2018-10-29
Author: yoptar@gmail.com
File Name: deeppavlov/core/common/cross_validation.py
Class Name:
Method Name: calc_cv_score


Project Name: NifTK/NiftyNet
Commit Name: 31fd5e11806c319b493b47fe029a48811445d9e8
Time: 2017-08-24
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/application_driver.py
Class Name: ApplicationDriver
Method Name: _training_loop