Skip to content
Snippets Groups Projects
Commit 9ebeb1d7 authored by Martyna Wiącek's avatar Martyna Wiącek
Browse files

save head and separate predictions in json file by line

parent de9301ad
No related merge requests found
Pipeline #9560 passed with stage
in 2 minutes and 21 seconds
...@@ -57,6 +57,7 @@ class Sentence: ...@@ -57,6 +57,7 @@ class Sentence:
return json.dumps({ return json.dumps({
"tokens": [(t.token, t.lemma, t.upostag, t.xpostag, t. feats, t.head, t.deprel) for t in self.tokens], "tokens": [(t.token, t.lemma, t.upostag, t.xpostag, t. feats, t.head, t.deprel) for t in self.tokens],
# "sentence_embedding": self.sentence_embedding, # "sentence_embedding": self.sentence_embedding,
"head": [t.head for t in self.tokens],
"relation_distribution_hash": hash, "relation_distribution_hash": hash,
"path_file": str(os.path.join(save_relation_distribution_path, hash + '.npz')) "path_file": str(os.path.join(save_relation_distribution_path, hash + '.npz'))
}, cls=NumpyArrayEncoder) }, cls=NumpyArrayEncoder)
......
...@@ -136,7 +136,7 @@ class COMBO(predictor.Predictor): ...@@ -136,7 +136,7 @@ class COMBO(predictor.Predictor):
else: else:
if not os.path.exists(self.save_relation_distribution_path): if not os.path.exists(self.save_relation_distribution_path):
os.makedirs(self.save_relation_distribution_path) os.makedirs(self.save_relation_distribution_path)
return outputs.to_json(self.save_relation_distribution_path) return outputs.to_json(self.save_relation_distribution_path) + "\n"
@staticmethod @staticmethod
def _to_input_json(sentence: str): def _to_input_json(sentence: str):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment