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

reward

parent e71cb62d
No related branches found
No related tags found
No related merge requests found
......@@ -389,12 +389,8 @@ class RougeReward:
class AmrReward:
name = "AmrReward"
safe_amr = {}
nlp = util.init_amr(STOG_MODEL_TRAIN)
def del_safe_amr(self):
self.safe_amr = {}
def __init__(self, weight=1, device="None"):
safe_score_region[self.name] = []
self.weight = weight
......@@ -403,11 +399,8 @@ 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")
score = calc_smatch_to_r(name="train", source=source, summary=summary, graph_source=graph_source, graph_summary=graph_summary)
else:
......
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