From fdf006015fae9503d5e27620b2b166638951179c Mon Sep 17 00:00:00 2001
From: Hsien-Chin Lin <linh@hhu.de>
Date: Wed, 25 Jan 2023 13:35:31 +0100
Subject: [PATCH] wip

---
 convlab/policy/emoTUS/self_bleu.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/convlab/policy/emoTUS/self_bleu.py b/convlab/policy/emoTUS/self_bleu.py
index 4a245cc0..0353c0d2 100644
--- a/convlab/policy/emoTUS/self_bleu.py
+++ b/convlab/policy/emoTUS/self_bleu.py
@@ -22,22 +22,23 @@ def get_sent(candidates):
     else:
         return [x["gen_utts"] for x in candidates["dialog"]]
 
+
 def SelfBLEU(sentences):
     metric = load_metric("sacrebleu")
     result = []
-    for i, sent in tqdm(enumerate(sentences),ascii=True):
-        r = metric.compute(predictions=[sent], references=[sentences[i:]+sentences[i+1:]])
+    for i, sent in tqdm(enumerate(sentences), ascii=True):
+        r = metric.compute(predictions=[sent], references=[
+                           sentences[i:]+sentences[i+1:]])
         result.append(r["score"])
 
-
     return sum(result)/len(result)
 
 
 def calculate(candidates):
     sentences = get_sent(candidates)
     bleu = SelfBLEU(sentences)
-    x = bleu.get_score()
-    print(x)
+    # x = bleu.get_score()
+    print(bleu)
 
 
 if __name__ == "__main__":
-- 
GitLab