Skip to content
Snippets Groups Projects
Commit 5a727d57 authored by wesenberg's avatar wesenberg
Browse files

17.

parent d797afc2
No related branches found
No related tags found
No related merge requests found
......@@ -389,6 +389,7 @@ class RougeReward:
class AmrReward:
name = "AmrReward"
safe_amr = {}
nlp = util.init_amr(STOG_MODEL_TRAIN)
def __init__(self, weight=1, device="None"):
......@@ -399,6 +400,11 @@ class AmrReward:
scores = []
for source, summary in zip(sources, summaries):
if source != "" and summary != "":
if source in self.safe_amr:
graph_source = self.safe_amr[source]
else:
graph_source = util.calc_one_amr(self.nlp, source, "train_source")
self.safe_amr[source] = graph_source
graph_source = util.calc_one_amr(self.nlp, source, "train_source")
graph_summary = util.calc_one_amr(self.nlp, summary, "train_summary")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment