Skip to content
Snippets Groups Projects
Unverified Commit f69b60bc authored by zz-jacob's avatar zz-jacob Committed by GitHub
Browse files

Merge pull request #57 from ConvLab/nlg-scgpt

Nlg scgpt
parents 9577daba fb1d2bac
Branches
No related tags found
No related merge requests found
import sys
from nltk.translate.bleu_score import corpus_bleu
import sacrebleu
from nltk.tokenize import word_tokenize
sys.path.append('../..')
import json
......@@ -32,9 +33,10 @@ def evaluate(predict_result, ontology):
references = []
candidates = []
for i in range(len(predict_result)):
references.append([word_tokenize(predict_result[i]['utterance'])])
candidates.append(word_tokenize(predict_result[i]['prediction']))
metrics['bleu'] = corpus_bleu(references, candidates)
references.append(predict_result[i]['utterance'])
candidates.append(predict_result[i]['prediction'])
# metrics['bleu'] = corpus_bleu(references, candidates)
metrics['bleu'] = sacrebleu.corpus_bleu(candidates, [references], lowercase=True).score
# ERROR Rate
## get all values in ontology
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment