Skip to content
Snippets Groups Projects
Commit 7eb1302a authored by Mateusz Klimaszewski's avatar Mateusz Klimaszewski
Browse files

Copy metadata from source file.

parent 761b4a25
No related merge requests found
......@@ -78,7 +78,8 @@ class UniversalDependenciesDatasetReader(allen_data.DatasetReader):
# dependencies for the original sentence.
# We filter by integers here as elided words have a non-integer word id,
# as parsed by the conllu python library.
annotation = conllu.TokenList([x for x in annotation if isinstance(x['id'], int)])
annotation = conllu.TokenList([x for x in annotation if isinstance(x['id'], int)],
metadata=annotation.metadata)
yield self.text_to_instance(annotation)
@overrides
......
......@@ -83,7 +83,8 @@ class SemanticMultitaskPredictor(predictor.Predictor):
return conllu.TokenList(
[d({'id': idx, 'token': token}) for
idx, token
in enumerate(sentence)]
in enumerate(sentence)],
metadata=collections.OrderedDict()
)
def _predictions_as_tree(self, predictions, instance):
......@@ -135,7 +136,7 @@ class SemanticMultitaskPredictor(predictor.Predictor):
raise NotImplementedError(f'Unknown field name {field_name}!')
if self._dataset_reader and 'sent' in self._dataset_reader._targets:
tree.metadata = {'sentence_embedding': str(predictions['sentence_embedding'])}
tree.metadata['sentence_embedding'] = str(predictions['sentence_embedding'])
return tree
@classmethod
......
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