From 29faf81fe3b3ecccd81dea5438c0b0182a4729c4 Mon Sep 17 00:00:00 2001 From: David Berenstein Date: Thu, 31 Mar 2022 09:41:08 +0200 Subject: [PATCH] resolvede empty coref issues #3 --- .gitignore | 3 ++- crosslingual_coreference/CrossLingualPredictor.py | 3 ++- crosslingual_coreference/examples/test_spacy.py | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5a99c24..299d33b 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,5 @@ dmypy.json .pyre/ /models *.tar.gz -/crosslingual_coreference/models \ No newline at end of file +/crosslingual_coreference/models +test.py diff --git a/crosslingual_coreference/CrossLingualPredictor.py b/crosslingual_coreference/CrossLingualPredictor.py index 1c6c4b3..f48fb6b 100644 --- a/crosslingual_coreference/CrossLingualPredictor.py +++ b/crosslingual_coreference/CrossLingualPredictor.py @@ -78,7 +78,8 @@ def predict(self, text: str, advanced_resolve: bool = True) -> dict: # Passing a document with no coreferences returns its original form if not clusters: - return text + prediction['resolved_text'] = text + return prediction doc = self.predictor._spacy(text) diff --git a/crosslingual_coreference/examples/test_spacy.py b/crosslingual_coreference/examples/test_spacy.py index bad9c9d..b4d7aa9 100644 --- a/crosslingual_coreference/examples/test_spacy.py +++ b/crosslingual_coreference/examples/test_spacy.py @@ -5,7 +5,6 @@ nlp = spacy.load('nl_core_news_sm') -nlp.remove_pipe('xx_coref') nlp.add_pipe('xx_coref', config={"model_name": "xlm_roberta"}) for doc in nlp.pipe(texts):