diff --git a/combo/data/api.py b/combo/data/api.py index deec11f83c4d21f168916f17979aa977fde35087..f25d035d5f428314055185449799e2ca5ff8987c 100644 --- a/combo/data/api.py +++ b/combo/data/api.py @@ -57,6 +57,7 @@ class Sentence: return json.dumps({ "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, + "head": [t.head for t in self.tokens], "relation_distribution_hash": hash, "path_file": str(os.path.join(save_relation_distribution_path, hash + '.npz')) }, cls=NumpyArrayEncoder) diff --git a/combo/predict.py b/combo/predict.py index ef44be2a45ea36ef9b66ffe181ec4b9d40a42af6..fe7eb1a9b3ef66756c63662dd49903a3b13e0b46 100644 --- a/combo/predict.py +++ b/combo/predict.py @@ -136,7 +136,7 @@ class COMBO(predictor.Predictor): else: if not os.path.exists(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 def _to_input_json(sentence: str):