Skip to content

Commit

Permalink
remove LabeledMultiSpan annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBinder committed Feb 19, 2024
1 parent c16a510 commit 97aaaa4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
11 changes: 0 additions & 11 deletions src/pytorch_ie/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@ def __post_init__(self) -> None:
_post_init_multi_label(self)


@dataclass(eq=True, frozen=True)
class LabeledMultiSpan(Annotation):
slices: Tuple[Tuple[int, int], ...]
label: str
score: float = field(default=1.0, compare=False)

def __post_init__(self) -> None:
_post_init_multi_span(self)
_post_init_single_label(self)


@dataclass(eq=True, frozen=True)
class MultiLabeledMultiSpan(Annotation):
slices: Tuple[Tuple[int, int], ...]
Expand Down
26 changes: 0 additions & 26 deletions tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pytorch_ie.annotations import (
BinaryRelation,
Label,
LabeledMultiSpan,
LabeledSpan,
MultiLabel,
MultiLabeledBinaryRelation,
Expand Down Expand Up @@ -126,31 +125,6 @@ def test_multilabeled_span():
MultiLabeledSpan(start=5, end=6, label=("label5", "label6"), score=(0.1, 0.2, 0.3))


def test_labeled_multi_span():
labeled_multi_span1 = LabeledMultiSpan(slices=((1, 2), (3, 4)), label="label1")
assert labeled_multi_span1.slices == ((1, 2), (3, 4))
assert labeled_multi_span1.label == "label1"
assert labeled_multi_span1.score == pytest.approx(1.0)

labeled_multi_span2 = LabeledMultiSpan(
slices=((5, 6), (7, 8)),
label="label2",
score=0.5,
)
assert labeled_multi_span2.slices == ((5, 6), (7, 8))
assert labeled_multi_span2.label == "label2"
assert labeled_multi_span2.score == pytest.approx(0.5)

assert labeled_multi_span2.asdict() == {
"_id": labeled_multi_span2._id,
"slices": ((5, 6), (7, 8)),
"label": "label2",
"score": 0.5,
}

_test_annotation_reconstruction(labeled_multi_span2)


def test_multilabeled_multi_span():
multilabeled_multi_span1 = MultiLabeledMultiSpan(
slices=((1, 2), (3, 4)), label=("label1", "label2")
Expand Down

0 comments on commit 97aaaa4

Please sign in to comment.