Skip to content

Commit

Permalink
WIP: Fix edsnlp and spacy optional imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ghisvail committed May 16, 2024
1 parent a9a6e01 commit 9f93689
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions medkit/text/ner/edsnlp_date_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from typing import Iterator

import spacy

from medkit.core.text import Entity, Segment, span_utils
from medkit.core.text.operation import NEROperation
from medkit.text.spacy.edsnlp import build_date_attribute, build_duration_attribute
Expand Down Expand Up @@ -47,6 +45,8 @@ def __init__(
attrs_to_copy: list[str] | None = None,
uid: str | None = None,
):
import spacy

super().__init__(output_label=output_label, attrs_to_copy=attrs_to_copy, uid=uid)

if attrs_to_copy is None:
Expand Down
4 changes: 2 additions & 2 deletions medkit/text/ner/edsnlp_tnm_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from typing import Iterator

import spacy

from medkit.core.text import Entity, Segment, span_utils
from medkit.core.text.operation import NEROperation
from medkit.text.ner.tnm_attribute import TNMAttribute
Expand Down Expand Up @@ -40,6 +38,8 @@ def __init__(
attrs_to_copy: list[str] | None = None,
uid: str | None = None,
):
import spacy

super().__init__(output_label=output_label, attrs_to_copy=attrs_to_copy, uid=uid)

if attrs_to_copy is None:
Expand Down
2 changes: 1 addition & 1 deletion medkit/text/ner/tnm_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from medkit._import import import_optional
from medkit.core import Attribute, dict_conv

_ = import_optional("edsnlp", extra="")
_ = import_optional("edsnlp", extra="edsnlp")

from edsnlp.pipelines.ner.tnm.model import ( # noqa: E402
TNM,
Expand Down

0 comments on commit 9f93689

Please sign in to comment.