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

Fix console prediction.

parent a5d36a1c
No related branches found
No related tags found
1 merge request!5Merge develop to master with documentation changes.
......@@ -146,6 +146,9 @@ def run(_):
else:
use_dataset_reader = FLAGS.conllu_format
predictor = _get_predictor()
if FLAGS.input_file == "-":
use_dataset_reader = False
predictor.without_sentence_embedding = True
if use_dataset_reader:
predictor.line_to_conllu = True
if FLAGS.silent:
......
......@@ -32,6 +32,7 @@ class SemanticMultitaskPredictor(predictor.Predictor):
self._dataset_reader.generate_labels = False
self._dataset_reader.lazy = True
self._tokenizer = tokenizer
self.without_sentence_embedding = False
self.line_to_conllu = line_to_conllu
def __call__(self, sentence: Union[str, List[str], List[List[str]], List[data.Sentence]]):
......@@ -127,6 +128,8 @@ class SemanticMultitaskPredictor(predictor.Predictor):
def dump_line(self, outputs: data.Sentence) -> str:
# Check whether serialized (str) tree or token's list
# Serialized tree has already separators between lines
if self.without_sentence_embedding:
outputs.sentence_embedding = []
if self.line_to_conllu:
return sentence2conllu(outputs, keep_semrel=self._dataset_reader.use_sem).serialize()
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment