Skip to content
Snippets Groups Projects
Commit 1c14365f authored by linh's avatar linh
Browse files

Merge branch 'genTUS_v2' of gitlab.cs.uni-duesseldorf.de:dsml/convlab/ConvLab3 into genTUS_v2

parents 0a706720 47aca1d9
No related branches found
No related tags found
No related merge requests found
......@@ -17,11 +17,17 @@ def read_file(file_name):
return nlg_candidates
def get_sent(candidates):
def get_sent(candidates, bleu_mode="torch"):
if bleu_mode == "torch":
if "log" in candidates:
return [x["gen_utts"] for x in candidates["log"]]
else:
return [x["gen_utts"] for x in candidates["dialog"]]
else:
if "log" in candidates:
return [x["gen_utts"].split() for x in candidates["log"]]
else:
return [x["gen_utts"].split() for x in candidates["dialog"]]
def SelfBLEU(sentences):
......@@ -36,7 +42,7 @@ def SelfBLEU(sentences):
def calculate(candidates, bleu_mode="torch"):
sentences = get_sent(candidates)
sentences = get_sent(candidates, bleu_mode)
if bleu_mode == "torch":
x = SelfBLEU(sentences)
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment