From 17d017a177bb71a44075cb35b13d7c1543d47600 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Tue, 15 Mar 2022 19:52:20 +0900 Subject: [PATCH] Remove span2head This doesn't work as a component because it needs to modify gold data, so instead it's a conversion script (in another repo). --- spacy/pipeline/coref.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/spacy/pipeline/coref.py b/spacy/pipeline/coref.py index db93051d7..861f2ec5e 100644 --- a/spacy/pipeline/coref.py +++ b/spacy/pipeline/coref.py @@ -91,32 +91,6 @@ DEFAULT_MODEL = Config().from_str(default_config)["model"] DEFAULT_CLUSTERS_PREFIX = "coref_clusters" -@Language.component("span2head") -def make_head_only_clusters(doc, old_key="coref_clusters", new_key="coref_head_clusters"): - """Create coref head clusters from span clusters. - - The old clusters are left alone, and the new clusters are added under a different key. - """ - final = [] - for key, sg in doc.spans.items(): - if not key.startswith("{old_key}_"): - continue - - heads = [span.root.i for span in sg] - heads = sorted(list(set(heads))) - head_spans = [doc[hh:hh+1] for hh in heads] - #print("===== headifying =====") - #print(sg) - #print(head_spans) - # singletons are skipped - if len(heads) > 1: - final.append(head_spans) - - # now add the new spangroups - for ii, spans in enumerate(final): - doc.spans[f"{new_key}_{ii}"] = spans - return doc - @Language.factory( "coref", assigns=["doc.spans"],