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

Fix console prediction.

parent 92b4e5c3
1 merge request!4Documentation
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
......@@ -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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment