def single_reference_sentence_bleu()

in augmentation/metrics.py [0:0]


def single_reference_sentence_bleu(reference: str, variant: str, stem: bool = False):

    def stem_sentence(sentence):
        return " ".join([
            STEMMER.stem(w)
            for w in word_tokenize(sentence)
        ])

    if stem:
        variant = stem_sentence(variant)
        reference = stem_sentence(reference)
    return sacrebleu.sentence_bleu(variant, [reference]).score