removing unused imports

This commit is contained in:
svlandeg 2021-05-27 16:31:38 +02:00
parent 910026582d
commit 04b55bf054
3 changed files with 6 additions and 13 deletions

View File

@ -6,15 +6,7 @@ from typing import List, Callable, Tuple, Any
from ...tokens import Doc from ...tokens import Doc
from ...util import registry from ...util import registry
from .coref_util import ( from .coref_util import get_candidate_mentions, select_non_crossing_spans, topk
get_predicted_clusters,
get_candidate_mentions,
select_non_crossing_spans,
make_clean_doc,
create_gold_scores,
logsumexp,
topk,
)
@registry.architectures("spacy.Coref.v1") @registry.architectures("spacy.Coref.v1")

View File

@ -44,6 +44,7 @@ def topk(xp, arr, k, axis=None):
def logsumexp(xp, arr, axis=None): def logsumexp(xp, arr, axis=None):
"""Emulate torch.logsumexp by returning the log of summed exponentials """Emulate torch.logsumexp by returning the log of summed exponentials
along each row in the given dimension. along each row in the given dimension.
TODO: currently not used?
Reduces a 2d array to 1d.""" Reduces a 2d array to 1d."""
# from slide 5 here: # from slide 5 here:
@ -217,6 +218,7 @@ def get_clusters_from_doc(doc) -> List[List[Tuple[int, int]]]:
def make_clean_doc(nlp, doc): def make_clean_doc(nlp, doc):
"""Return a doc with raw data but not span annotations.""" """Return a doc with raw data but not span annotations."""
# Surely there is a better way to do this? # Surely there is a better way to do this?
# TODO: currently not used?
sents = [tok.is_sent_start for tok in doc] sents = [tok.is_sent_start for tok in doc]
words = [tok.text for tok in doc] words = [tok.text for tok in doc]

View File

@ -17,7 +17,6 @@ from ..ml.models.coref_util import (
create_gold_scores, create_gold_scores,
MentionClusters, MentionClusters,
get_clusters_from_doc, get_clusters_from_doc,
logsumexp,
get_predicted_clusters, get_predicted_clusters,
DEFAULT_CLUSTER_PREFIX, DEFAULT_CLUSTER_PREFIX,
doc2clusters, doc2clusters,